From c653a3740f00001cb4e3e1ef79b0a93cc2091a69 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Aug 2023 05:44:50 +0000 Subject: [PATCH 001/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ecc3e9c..0e7934a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "github:stdlib-js/array-base-fillednd#main", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.0.7", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c08dd267a5cfeeb699353a233ea3f0e957c97b23 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Aug 2023 05:46:05 +0000 Subject: [PATCH 002/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 260 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 616 -- 45 files changed, 12399 insertions(+), 4666 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 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..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 `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 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 e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index d8811e2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index a41e9a0..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -89,8 +97,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index bfc6bf8..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled two-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index b36c48c..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/object'; - -// FIXME: shapes should be collections of a defined length - -/** -* One-dimensional array. -*/ -type Array1D = Collection; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Collection ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..fe5112e --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..40f145d --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 4ee2bdc5add0adf0f3fbd2e18602441b91afc91a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Aug 2023 06:37:25 +0000 Subject: [PATCH 003/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ecc3e9c..0e7934a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "github:stdlib-js/array-base-fillednd#main", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.0.7", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ec5d90c83fa20aa984c57ae9c73a26dc8f52008f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Aug 2023 06:37:54 +0000 Subject: [PATCH 004/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 40f145d..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From cc124a761a1a7f0ef8699f9b96981c75b11f0339 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Aug 2023 06:38:53 +0000 Subject: [PATCH 005/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 260 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 616 -- 45 files changed, 12399 insertions(+), 4666 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 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..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 `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 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 e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index d8811e2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index a41e9a0..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -89,8 +97,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index b36c48c..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/object'; - -// FIXME: shapes should be collections of a defined length - -/** -* One-dimensional array. -*/ -type Array1D = Collection; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Collection ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..f861def --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..88780c4 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From fd525f5fca1ecba9361be5f6b8054c52f8e7293a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 17 Aug 2023 02:27:41 +0000 Subject: [PATCH 006/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ecc3e9c..0e7934a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "github:stdlib-js/array-base-fillednd#main", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.0.7", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 7383153099c2cc005be7624169b4a4423375ae21 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 17 Aug 2023 02:40:24 +0000 Subject: [PATCH 007/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 88780c4..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 24ce05e3d9738d9c39b44e908b9d2252789947b6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 17 Aug 2023 02:41:17 +0000 Subject: [PATCH 008/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 260 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 616 -- 45 files changed, 12399 insertions(+), 4666 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 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..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 `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 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 e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index d8811e2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index a41e9a0..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -89,8 +97,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 2cd4a92..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; - -// FIXME: shapes should be collections of a defined length - -/** -* One-dimensional array. -*/ -type Array1D = Collection; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Collection ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..523d32c --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..7f5cbc3 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From ec87191125010c92aa4396ea0e87bd0c22aaff0a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 22:01:34 +0000 Subject: [PATCH 009/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ecc3e9c..0e7934a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "github:stdlib-js/array-base-fillednd#main", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.0.7", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 0e177a1f86b3671ceda51f4211344ccf02893f07 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 22:02:33 +0000 Subject: [PATCH 010/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 7f5cbc3..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 20dd405c3e49c818d9e67f1b16714fbc7a12c6d2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 22:03:11 +0000 Subject: [PATCH 011/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 616 -- 45 files changed, 12399 insertions(+), 4665 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 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..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 `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 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 e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index d8811e2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index a41e9a0..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -89,8 +97,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1aeaf1a..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; // tslint:disable-line:no-unnecessary-generics - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..831def7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..db30fb7 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 063594644e0a1c7f81581c38f0f35792cbda49cd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 25 Aug 2023 00:30:46 +0000 Subject: [PATCH 012/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1a855f8..38eda3f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.0.1", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.0.7", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ec587307a183e95adc5a6a4c88586287e3799801 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 25 Aug 2023 00:31:40 +0000 Subject: [PATCH 013/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index db30fb7..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 34bb6af6eead7ccbb888f881b331742f0da07b4b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 25 Aug 2023 00:32:25 +0000 Subject: [PATCH 014/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 616 -- 45 files changed, 12399 insertions(+), 4665 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 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..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 `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 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 e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index d8811e2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index a41e9a0..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1aeaf1a..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; // tslint:disable-line:no-unnecessary-generics - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..516db4e --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..21daf42 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 1e072e6c1a6fb48dc1c752cdbcaa500c0c10420e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 25 Aug 2023 00:32:42 +0000 Subject: [PATCH 015/105] Update README.md for UMD bundle v0.0.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80a120b..51f1cfd 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@umd/browser.js' ) +zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@v0.0.1-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var zerosnd = require( 'path/to/vendor/umd/array-base-zerosnd/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +112,7 @@ var out = zerosnd( [ 2, 3 ] ); - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +117,7 @@ var out = zerosnd( [ 2, 3 ] ); - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 21daf42..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 41085486b2724fb20b45149394a2f7e640fc4973 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 15:47:45 +0000 Subject: [PATCH 019/105] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 616 -- 46 files changed, 12399 insertions(+), 4700 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index d8811e2..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index a41e9a0..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1aeaf1a..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; // tslint:disable-line:no-unnecessary-generics - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..75742db --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..7cce6d5 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From c8dcaa3fc5d3e0ce037014000d8647b94ee154d9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 15:54:18 +0000 Subject: [PATCH 020/105] Update README.md for UMD bundle v0.1.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 79a5bd3..36e58d9 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@umd/browser.js' ) +zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@v0.1.0-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var zerosnd = require( 'path/to/vendor/umd/array-base-zerosnd/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +112,7 @@ var out = zerosnd( [ 2, 3 ] ); - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +117,7 @@ var out = zerosnd( [ 2, 3 ] ); - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 7cce6d5..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 63260b725018d40300827635ed5a1e4b218102e1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 3 Oct 2023 01:10:58 +0000 Subject: [PATCH 024/105] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 616 -- test/test.js | 616 -- 48 files changed, 12399 insertions(+), 5375 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 131a88d..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T05:12:04.713Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index ed2f8cc..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/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b0ef5a6..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1aeaf1a..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; // tslint:disable-line:no-unnecessary-generics - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..ccb544b --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..7341f93 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 7e9ca22..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From fb133a708e3ca22bcc8e0c7a895ed94a06adcb04 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 19:28:18 +0000 Subject: [PATCH 025/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 10b9716..cc17341 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.1.0", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.1.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From fa785c7c8aa1652ff5aae5e40b26f04e166afab7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Oct 2023 02:16:00 +0000 Subject: [PATCH 026/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 7341f93..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 93b6557aed71aaa2472d17bcab8abe6bc96c6f2c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Oct 2023 02:16:42 +0000 Subject: [PATCH 027/105] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 616 -- test/test.js | 616 -- 47 files changed, 12399 insertions(+), 5374 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index ed2f8cc..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/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b0ef5a6..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1aeaf1a..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; // tslint:disable-line:no-unnecessary-generics - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..4795ac7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..55a157b --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 7e9ca22..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 614b6413af87136e416576c3d4758f38e2de4d51 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Nov 2023 17:00:05 +0000 Subject: [PATCH 028/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f55ac51..a49aff7 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.1.0", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.1.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 91342260b524c4516a0a08c718c9af2a0df0e857 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 01:27:15 +0000 Subject: [PATCH 029/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 55a157b..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b8e5604fc693000e25340bf9d8ce77d0354ee428 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 01:28:11 +0000 Subject: [PATCH 030/105] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 -- 48 files changed, 12399 insertions(+), 4800 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 3772607..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T05:29:06.252Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index ed2f8cc..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/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b0ef5a6..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1aeaf1a..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; // tslint:disable-line:no-unnecessary-generics - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..509730e --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..077c40f --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From d062b2634bac6762df9c99064a44cc5b5dacb0d7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 15:10:23 +0000 Subject: [PATCH 031/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ca371db..b8d2c6d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.1.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 61674fe8619b26f03448071956111b7889cb079f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 15:13:33 +0000 Subject: [PATCH 032/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 077c40f..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1ebf238cdcf98abe727a154a441975748aeaccad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 15:14:07 +0000 Subject: [PATCH 033/105] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 -- 47 files changed, 12399 insertions(+), 4799 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index ed2f8cc..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/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b0ef5a6..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 991c6ea..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; // tslint:disable-line:no-single-element-tuple-type - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..5fbbd74 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..8817c4e --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From b03b1c2116a04a05c76778e67417f829003e2bf7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 21:24:56 +0000 Subject: [PATCH 034/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ca371db..b8d2c6d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.1.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 896e80819b4751692dde0eee7255962982d3ed8b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 21:32:58 +0000 Subject: [PATCH 035/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 8817c4e..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b0916b4df41ec81d266dd3e3fc0cd6a5c9549a05 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 21:33:55 +0000 Subject: [PATCH 036/105] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 -- 47 files changed, 12399 insertions(+), 4799 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index ed2f8cc..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/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b0ef5a6..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..fbcd9cc --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..042825f --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 5414989d56bc14043111d511367444307cbb613c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 13:10:25 +0000 Subject: [PATCH 037/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ffd4827..827f5b5 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.1.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 0eb6b1255e09f602d46cb42d543a3145ed613123 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:11:00 +0000 Subject: [PATCH 038/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 042825f..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a39e5018a627765c14439950c88fe8f879be8dbc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:11:48 +0000 Subject: [PATCH 039/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 -- 48 files changed, 12399 insertions(+), 4795 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 69a2fdb..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T05:33:40.164Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index ed2f8cc..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/zerosnd) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index b0ef5a6..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index ebbeb56..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 1acb202..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f1b626e..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index ecdb3c1..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..a3ab975 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..6b08384 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..1870571 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..4e6daa6 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 20b742a10daab38a43b9f331997c5bbed4028c18 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 07:51:28 +0000 Subject: [PATCH 040/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 800826b..d6952b4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.1.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 6162df375546f5d96053d67e28b73cdff0f4cfa7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:29:29 +0000 Subject: [PATCH 041/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index a3ab975..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 4e6daa6..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7b5d1d82f71a6fc3a3fda503e6800b2a00509cfb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:29:48 +0000 Subject: [PATCH 042/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 -- 49 files changed, 12399 insertions(+), 4801 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 4d360c8..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T05:03:09.374Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 4645e94..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -100,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index fb1b688..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..d90aa32 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..40269a5 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From fa98da8517092605b0efb8e45c17ba27a4067374 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 08:21:01 +0000 Subject: [PATCH 043/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 800826b..d6952b4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.1.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From cfafa394ea0d7b6a880283ad475d46d0e982938c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 13:42:30 +0000 Subject: [PATCH 044/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 40269a5..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9c1b422e75c8e08f08ef1fda4f32bc4f32ef602f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 13:42:56 +0000 Subject: [PATCH 045/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 -- 49 files changed, 12398 insertions(+), 4805 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index f06be1b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T05:51:21.761Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 4645e94..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..d018cca --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..3ddbcff --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 8cd3fda9927ece5d6931079e74b6301df52c283d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 23:50:01 +0000 Subject: [PATCH 046/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a80552d..f3e19eb 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.0", - "@stdlib/types": "^0.3.1" + "@stdlib/types": "^0.3.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.0", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 95861c0b065537e0749285e021684fc5a841780d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 02:26:57 +0000 Subject: [PATCH 047/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 3ddbcff..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 11ad41bbcb41a87b99eb17aa4c5cc08fcb8359e8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 02:27:23 +0000 Subject: [PATCH 048/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 -- 48 files changed, 12398 insertions(+), 4808 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1dccb94..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..634b15c --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..c8b3387 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 2e292def6c2eb63b318f341d190305e541c7652d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:10:58 +0000 Subject: [PATCH 049/105] Update README.md for UMD bundle v0.2.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a35bbd1..91ff94d 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@umd/browser.js' ) +zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@v0.2.0-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var zerosnd = require( 'path/to/vendor/umd/array-base-zerosnd/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +112,7 @@ var out = zerosnd( [ 2, 3 ] ); - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +117,7 @@ var out = zerosnd( [ 2, 3 ] ); - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index c8b3387..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9bb701766c5e1f2e910019371764cd07e0fb611a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:13:07 +0000 Subject: [PATCH 053/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 48 files changed, 9728 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 9c2570bd52b53ddba07b8ab94016eeec4ad08676 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:43:56 +0000 Subject: [PATCH 054/105] Update README.md for UMD bundle v0.2.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5167bd3..4d6e3b1 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@umd/browser.js' ) +zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@v0.2.1-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var zerosnd = require( 'path/to/vendor/umd/array-base-zerosnd/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +112,7 @@ var out = zerosnd( [ 2, 3 ] ); - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +117,7 @@ var out = zerosnd( [ 2, 3 ] ); - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d8220ac777f515f8e8d1c07097225b1fbe9de99b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 13:20:02 +0000 Subject: [PATCH 058/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 49 files changed, 9728 insertions(+), 4804 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 0e6d846..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T05:33:37.331Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 5b04e773c05453487d5b390568c635b7c2491dcf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 07:00:55 +0000 Subject: [PATCH 059/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d9ef4e8..ae17bd7 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 421f3ee52bf69f9ee02f82b517c5c4565dc10299 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:13:53 +0000 Subject: [PATCH 060/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6b8865513c0532c00bf3fc1170a993f10d0b2599 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:14:13 +0000 Subject: [PATCH 061/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 49 files changed, 9728 insertions(+), 4807 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index adfddff..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T04:52:46.340Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 1dfef8821e418086ab38d80e052506ce6857895b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 03:17:29 +0000 Subject: [PATCH 062/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d9ef4e8..ae17bd7 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From bc83cd47c18ee80f67ad7452a3eedc8fc60d5c25 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:38:39 +0000 Subject: [PATCH 063/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b26516dade1a2f914e5e9cce99fbbad883631c9e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:38:53 +0000 Subject: [PATCH 064/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 134 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 48 files changed, 9728 insertions(+), 4808 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 8b9ba186c12dff71d4cba2d8f25ee8995bc0a160 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 18 May 2024 03:02:13 +0000 Subject: [PATCH 065/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d9ef4e8..ae17bd7 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.1", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 0491120b8ee4db970355c93afba488e372b8b1a9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 18 May 2024 03:03:20 +0000 Subject: [PATCH 066/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From af70dc80573a10b516a6ce721badcb89d5c31fda Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 18 May 2024 03:03:33 +0000 Subject: [PATCH 067/105] 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 | 248 -- .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 | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 48 files changed, 9734 insertions(+), 4821 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # 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 +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 23611d468c1a4d72e8aaf7f20b571c40cb0501c2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:18:22 +0000 Subject: [PATCH 068/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0e93767..e31c4cf 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e5111e7aa3f0f57ac328f889fd719091094fc3f0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:20:16 +0000 Subject: [PATCH 069/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8e4b9dadf3a0a3a906dd8a2d1afb8556e234224a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:20:29 +0000 Subject: [PATCH 070/105] 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 | 138 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 48 files changed, 9734 insertions(+), 4960 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 1687353e0ad6d5c2d1c02752a1f310ddd038bd44 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:21:17 +0000 Subject: [PATCH 071/105] Update README.md for UMD bundle v0.2.2 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9aaebca..466dd8f 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ limitations under the License. To use in Observable, ```javascript -zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@umd/browser.js' ) +zerosnd = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zerosnd@v0.2.2-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -66,7 +66,7 @@ var zerosnd = require( 'path/to/vendor/umd/array-base-zerosnd/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +112,7 @@ var out = zerosnd( [ 2, 3 ] ); - + + ``` If no recognized module system is present, access bundle contents via the global scope: @@ -112,7 +117,7 @@ var out = zerosnd( [ 2, 3 ] ); - + - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4857f982175dad292a09f215b5a1cc6091ff76b3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 12:39:22 +0000 Subject: [PATCH 075/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 88 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 49 files changed, 9734 insertions(+), 4911 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 3a822b5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T05:43:27.413Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 625a5364323d388d2cf46f608fcdd179f875ffd0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 08:12:09 +0000 Subject: [PATCH 076/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index af8bece..540ec57 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From fa645bc38503c9cf8d3b93f659447ad094b60f3e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:31:33 +0000 Subject: [PATCH 077/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8d1122a9320816c63231bd7af68234f5321ebf46 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:31:59 +0000 Subject: [PATCH 078/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 138 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 259 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 49 files changed, 9734 insertions(+), 4961 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 4424579..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T06:09:23.231Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 1519d73..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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'; -import { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 06bf5e933f5c639a79e12efcefc41f2704e8f8af Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 28 Sep 2024 21:16:34 +0000 Subject: [PATCH 079/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index af8bece..540ec57 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e76ea209d0165b6dbf441a323151e7623ea5fcf4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 28 Sep 2024 21:20:06 +0000 Subject: [PATCH 080/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2e5454258977b40cd857444b0f2b915c96f47f2d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 28 Sep 2024 21:20:21 +0000 Subject: [PATCH 081/105] 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 | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 48 files changed, 9734 insertions(+), 4993 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 1920138aa2e375def729b1140f324466253af3aa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 08:25:36 +0000 Subject: [PATCH 082/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index af8bece..540ec57 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8c21a5b231f4d68543a9e774f530ccf896974bca Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:03:47 +0000 Subject: [PATCH 083/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 847966c778fb763bcd76c8aa0888eb41b59bd38e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:04:05 +0000 Subject: [PATCH 084/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 49 files changed, 9734 insertions(+), 4994 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 6a2f7fd..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T06:21:44.125Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 98ec84cba2c3f2d69961297448254141679b9928 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 08:15:38 +0000 Subject: [PATCH 085/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index af8bece..540ec57 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 9a72ae71642fa91bf0f4e4085ca684a74936127a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:12:54 +0000 Subject: [PATCH 086/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From dc7184a585b666a2fd0c0a06111471acdae15154 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:13:09 +0000 Subject: [PATCH 087/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 -- docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 49 files changed, 9734 insertions(+), 4994 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index df672c4..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T06:24:47.074Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From e5078e911a257c887be78b23a6b72149c0e1003f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 08:31:13 +0000 Subject: [PATCH 088/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b39ae9a..c16df3e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 6f8da9b18a9fd9f13fbd4c99bdef2e8a0586d9a5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:37:55 +0000 Subject: [PATCH 089/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5a10fb173ecfb00894d78d5d80b693b4ee2b6e64 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:38:13 +0000 Subject: [PATCH 090/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 50 files changed, 9734 insertions(+), 5099 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index ea62134..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T06:34:16.276Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 8776751be40b0159d976c7b6b62d742976ffc312 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 02:11:17 +0000 Subject: [PATCH 091/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b39ae9a..c16df3e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b837811e79cdfe299d88ee39fac79eac7356e270 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 02:29:31 +0000 Subject: [PATCH 092/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From bc4f9afd9e839cd7f4be9990a6a5764114619d77 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 02:29:48 +0000 Subject: [PATCH 093/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 50 files changed, 9734 insertions(+), 5099 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 326446b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-09T02:05:04.511Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From ebce92b0c870dc6145ff2170389b184a37f0b62e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 03:22:14 +0000 Subject: [PATCH 094/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b39ae9a..c16df3e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f3a40abafa4df218ece83c586bd9a323c1a82fd4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 04:35:48 +0000 Subject: [PATCH 095/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0cef1d6b7edb48eced9759b9c1cc4150c676b7f6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 04:36:03 +0000 Subject: [PATCH 096/105] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 50 files changed, 9734 insertions(+), 5099 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 5eb3dc9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-30T02:53:15.958Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..6a88526 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..07de3b9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From b9ef94fd9dd959bdedee4472154912cea27fca26 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 20 Jan 2025 01:47:43 +0000 Subject: [PATCH 097/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b39ae9a..c16df3e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b2d4e584f80f05cf7480df7b1d672b9191d562ed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 20 Jan 2025 02:03:41 +0000 Subject: [PATCH 098/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 6a88526..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4e436e20c75747ccaf38fbbf93c91c9cb2c330d4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 20 Jan 2025 02:03:57 +0000 Subject: [PATCH 099/105] 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 | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 50 files changed, 9734 insertions(+), 5098 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 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 eb0a67a..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-01-20T01:42:39.407Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index e4ed56c..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..d8006ef --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..2d74192 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 0443b2e9b282d3f53a5ad25eea39e24a893c9d36 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 00:43:51 +0000 Subject: [PATCH 100/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b39ae9a..c16df3e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 7179c979312e6d08acdc9746558a18e3812c16a9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 00:53:48 +0000 Subject: [PATCH 101/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index d8006ef..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d46c087281339081c3db27685107239ddc6194ab Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 00:54:05 +0000 Subject: [PATCH 102/105] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 50 files changed, 9734 insertions(+), 5102 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 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 656b98e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-04-07T00:43:05.746Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b5c8ef8..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..d8006ef --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..2d74192 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); From 21d8e44d674bf86286ab774e187f193aa5d52b7e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Apr 2025 00:50:07 +0000 Subject: [PATCH 103/105] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b39ae9a..c16df3e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-fillednd": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-array-array": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 7075e7fdf2f7a77aa436464f0358801556e3cd5b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Apr 2025 00:59:23 +0000 Subject: [PATCH 104/105] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index d8006ef..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de1c8cb..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8cda481b9bb4dd261e83ae85fcca7b8637242fbb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Apr 2025 00:59:39 +0000 Subject: [PATCH 105/105] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 172 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 64 +- SECURITY.md | 5 - benchmark/benchmark.size.2d.js | 96 - benchmark/benchmark.size.3d.js | 96 - benchmark/benchmark.size.4d.js | 95 - benchmark/benchmark.size.5d.js | 95 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 22 - docs/types/index.d.ts | 258 - docs/types/test.ts | 48 - examples/index.js | 41 - index.js | 3 + index.js.map | 1 + lib/index.js | 40 - lib/main.js | 49 - package.json | 59 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 616 --- 50 files changed, 9734 insertions(+), 5102 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.size.2d.js delete mode 100644 benchmark/benchmark.size.3d.js delete mode 100644 benchmark/benchmark.size.4d.js delete mode 100644 benchmark/benchmark.size.5d.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 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 dfcab3f..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-04-14T00:47:31.592Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b5c8ef8..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/zerosnd) 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 ed2f8cc..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/zerosnd) 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 1d90f1d..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: '26 14 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### zerosnd( shape ) @@ -102,8 +108,13 @@ var out = zerosnd( [ 2, 3 ] ); -```javascript -var zerosnd = require( '@stdlib/array-base-zerosnd' ); +```html + + + + + + + ```
@@ -226,17 +242,17 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros +[@stdlib/array/base/zeros]: https://github.com/stdlib-js/array-base-zeros/tree/umd -[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd +[@stdlib/array/base/onesnd]: https://github.com/stdlib-js/array-base-onesnd/tree/umd -[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d +[@stdlib/array/base/zeros2d]: https://github.com/stdlib-js/array-base-zeros2d/tree/umd -[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d +[@stdlib/array/base/zeros3d]: https://github.com/stdlib-js/array-base-zeros3d/tree/umd -[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d +[@stdlib/array/base/zeros4d]: https://github.com/stdlib-js/array-base-zeros4d/tree/umd -[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d +[@stdlib/array/base/zeros5d]: https://github.com/stdlib-js/array-base-zeros5d/tree/umd 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.size.2d.js b/benchmark/benchmark.size.2d.js deleted file mode 100644 index c02cf25..0000000 --- a/benchmark/benchmark.size.2d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( sqrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::2d,equidimensional:size='+(N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.3d.js b/benchmark/benchmark.size.3d.js deleted file mode 100644 index 88ab297..0000000 --- a/benchmark/benchmark.size.3d.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( cbrt( pow( 10, i ) ) ); - - f = createBenchmark( N ); - bench( pkg+'::3d,equidimensional:size='+(N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.4d.js b/benchmark/benchmark.size.4d.js deleted file mode 100644 index f288709..0000000 --- a/benchmark/benchmark.size.4d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::4d,equidimensional:size='+(N*N*N*N), f ); - } -} - -main(); diff --git a/benchmark/benchmark.size.5d.js b/benchmark/benchmark.size.5d.js deleted file mode 100644 index f2aec73..0000000 --- a/benchmark/benchmark.size.5d.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 floor = require( '@stdlib/math-base-special-floor' ); -var isArrayArray = require( '@stdlib/assert-is-array-array' ); -var pkg = require( './../package.json' ).name; -var zerosnd = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} N - array lengths -* @returns {Function} benchmark function -*/ -function createBenchmark( N ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = zerosnd( [ N, N, N, N, N ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array of arrays' ); - } - } - b.toc(); - if ( !isArrayArray( out ) ) { - b.fail( 'should return an array of arrays' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - - f = createBenchmark( N ); - bench( pkg+'::5d,equidimensional:size='+(N*N*N*N*N), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 16a6ad2..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/zerosnd" -%% click B href "https://github.com/stdlib-js/array-base-zerosnd/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-zerosnd/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-zerosnd/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-zerosnd/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-zerosnd/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/zerosnd -[production-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-zerosnd/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-zerosnd/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..d8006ef --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r -import zerosnd from '../docs/types/index'; -export = zerosnd; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d05b1f2..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=s(function(c,t){ -var n=require('@stdlib/array-base-fillednd/dist');function u(e){return n(0,e)}t.exports=u -});var o=i();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index f5163bc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar fillednd = require( '@stdlib/array-base-fillednd' );\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled n-dimensional nested array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} filled array\n*\n* @example\n* var out = zerosnd( [ 3 ] );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\nfunction zerosnd( shape ) {\n\treturn fillednd( 0.0, shape );\n}\n\n\n// EXPORTS //\n\nmodule.exports = zerosnd;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Create a zero-filled n-dimensional nested array.\n*\n* @module @stdlib/array-base-zerosnd\n*\n* @example\n* var zerosnd = require( '@stdlib/array-base-zerosnd' );\n*\n* var out = zerosnd( [ 1, 3 ] );\n* // returns [ [ 0.0, 0.0, 0.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,6BAA8B,EAmBtD,SAASC,EAASC,EAAQ,CACzB,OAAOF,EAAU,EAAKE,CAAM,CAC7B,CAKAH,EAAO,QAAUE,ICdjB,IAAIE,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "fillednd", "zerosnd", "shape", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f580d1f..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( shape ) - Returns a zero-filled n-dimensional nested array. - - Parameters - ---------- - shape: Array - Array shape. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var out = {{alias}}( [ 1, 3 ] ) - [ [ 0.0, 0.0, 0.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6ac1768..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Shape } from '@stdlib/types/ndarray'; - -/** -* One-dimensional array. -*/ -type Array1D = Array; - -/** -* One-dimensional array shape. -*/ -type Shape1D = [ number ]; - -/** -* Two-dimensional array. -*/ -type Array2D = Array>; - -/** -* Two-dimensional array shape. -*/ -type Shape2D = [ number, number ]; - -/** -* Three-dimensional array. -*/ -type Array3D = Array>; - -/** -* Three-dimensional array shape. -*/ -type Shape3D = [ number, number, number ]; - -/** -* Four-dimensional array. -*/ -type Array4D = Array>; - -/** -* Four-dimensional array shape. -*/ -type Shape4D = [ number, number, number, number ]; - -/** -* Five-dimensional array. -*/ -type Array5D = Array>; - -/** -* Five-dimensional array shape. -*/ -type Shape5D = [ number, number, number, number, number ]; - -/** -* Six-dimensional array. -*/ -type Array6D = Array>; - -/** -* Six-dimensional array shape. -*/ -type Shape6D = [ number, number, number, number, number, number ]; - -/** -* Seven-dimensional array. -*/ -type Array7D = Array>; - -/** -* Seven-dimensional array shape. -*/ -type Shape7D = [ number, number, number, number, number, number, number ]; - -/** -* Eight-dimensional array. -*/ -type Array8D = Array>; - -/** -* Eight-dimensional array shape. -*/ -type Shape8D = [ number, number, number, number, number, number, number, number ]; - -/** -* Nine-dimensional array. -*/ -type Array9D = Array>; - -/** -* Nine-dimensional array shape. -*/ -type Shape9D = [ number, number, number, number, number, number, number, number, number ]; - -/** -* Ten-dimensional array. -*/ -type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes - -/** -* Ten-dimensional array shape. -*/ -type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; - -/** -* Returns a zero-filled one-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 3 ] ); -* // returns [ 0.0, 0.0, 0.0 ] -*/ -declare function zerosnd( shape: Shape1D ): Array1D; -/** -* Returns a zero-filled two-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 3 ] ); -* // returns [ [ 0.0, 0.0, 0.0 ] ] -*/ -declare function zerosnd( shape: Shape2D ): Array2D; -/** -* Returns a zero-filled three-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 3 ] ); -* // returns [ [ [ 0.0, 0.0, 0.0 ] ] ] -*/ -declare function zerosnd( shape: Shape3D ): Array3D; - -/** -* Returns a zero-filled four-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 3 ] ); -* // returns [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] -*/ -declare function zerosnd( shape: Shape4D ): Array4D; - -/** -* Returns a zero-filled five-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape5D ): Array5D; - -/** -* Returns a zero-filled six-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape6D ): Array6D; - -/** -* Returns a zero-filled seven-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape7D ): Array7D; - -/** -* Returns a zero-filled eight-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape8D ): Array8D; - -/** -* Returns a zero-filled nine-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape9D ): Array9D; - -/** -* Returns a zero-filled ten-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape10D ): Array10D; - -/** -* Returns a zero-filled n-dimensional nested array. -* -* @param shape - array shape -* @returns output array -* -* @example -* var out = zerosnd( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ] ); -* // returns [ [ [ [ [ [ [ [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] ] ] ] ] ] ] -*/ -declare function zerosnd( shape: Shape ): Array; - - -// EXPORTS // - -export = zerosnd; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5e604f6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 zerosnd = require( './index' ); - - -// TESTS // - -// The function returns a nested array... -{ - zerosnd( [ 3 ] ); // $ExpectType Array1D - zerosnd( [ 1, 3 ] ); // $ExpectType Array2D - zerosnd( [ 1, 1, 3 ] ); // $ExpectType Array3D - zerosnd( [ 1, 1, 1, 3 ] ); // $ExpectType Array4D - zerosnd( [ 1, 1, 1, 1, 3 ] ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not an array of numbers... -{ - zerosnd( 'abc' ); // $ExpectError - zerosnd( true ); // $ExpectError - zerosnd( false ); // $ExpectError - zerosnd( null ); // $ExpectError - zerosnd( [ '1' ] ); // $ExpectError - zerosnd( {} ); // $ExpectError - zerosnd( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - zerosnd(); // $ExpectError - zerosnd( [ 1, 3 ], 2 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0dc47e1..0000000 --- a/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zerosnd = require( './../lib' ); - -var out = zerosnd( [ 1, 3 ] ); -console.log( out ); -// => [ [ 0.0, 0.0, 0.0 ] ] - -out = zerosnd( [ 3, 1 ] ); -console.log( out ); -// => [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] - -out = zerosnd( [ 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ 0.0, 0.0, 0.0 ] ] ] - -out = zerosnd( [ 1, 3, 1 ] ); -console.log( out ); -// => [ [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ] ] - -out = zerosnd( [ 1, 1, 1, 3 ] ); -console.log( out ); -// => [ [ [ [ 0.0, 0.0, 0.0 ] ] ] ] diff --git a/index.js b/index.js new file mode 100644 index 0000000..2d74192 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,n;e=this,n=function(){"use strict";function e(n,t,r,o,f){var u,i,d;if(u=r[o],(i=o+1)===t)return function(e,n){var t,r;for(t=[],r=0;r=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -90,4 +35,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..bb3cfba --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de1c8cb --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 0b36573..0000000 --- a/test/test.js +++ /dev/null @@ -1,616 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zerosnd = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zerosnd, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a filled nested array (0d)', function test( t ) { - var expected; - var actual; - - expected = []; - actual = zerosnd( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (1d)', function test( t ) { - var expected; - var actual; - - expected = [ 0.0, 0.0, 0.0 ]; - actual = zerosnd( [ 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [ 0.0, 0.0, 0.0 ] ]; - actual = zerosnd( [ 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0 ], [ 0.0 ], [ 0.0 ] ]; - actual = zerosnd( [ 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - actual = zerosnd( [ 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (3d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ]; - actual = zerosnd( [ 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ]; - actual = zerosnd( [ 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a filled nested array', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ - [ 0.0, 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ], - [ - [ - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ], - [ - [ 0.0 ], - [ 0.0 ], - [ 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 2, 1, 2, 3, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ], - [ - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ], - [ - [ 0.0, 0.0 ], - [ 0.0, 0.0 ], - [ 0.0, 0.0 ] - ] - ] - ] - ]; - actual = zerosnd( [ 1, 2, 2, 3, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a shape having a first element equal to zero (1d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (2d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (3d)', function test( t ) { - var expected; - var actual; - - expected = [ [ [] ] ]; - actual = zerosnd( [ 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [] ] ]; - actual = zerosnd( [ 1, 2, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [ [], [], [] ] ]; - actual = zerosnd( [ 1, 3, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (4d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty outer array if provided a shape having a first element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = []; - - actual = zerosnd( [ 0, 1, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 0, 0, 0, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = zerosnd( [ 0, 100, 100, 100, 100 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a second element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ [] ]; - actual = zerosnd( [ 1, 0, 1, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [] ]; - actual = zerosnd( [ 2, 0, 2, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ [], [], [] ]; - actual = zerosnd( [ 3, 0, 3, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a third element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [] - ] - ]; - actual = zerosnd( [ 1, 1, 0, 1, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [] - ] - ]; - actual = zerosnd( [ 1, 2, 0, 2, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [], - [], - [] - ] - ]; - actual = zerosnd( [ 1, 3, 0, 3, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fourth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 0, 1 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 0, 2 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [] ], - [ [] ], - [ [] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 0, 3 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns empty inner arrays if provided a shape having a fifth element equal to zero (5d)', function test( t ) { - var expected; - var actual; - - expected = [ - [ - [ - [ [] ] - ] - ] - ]; - actual = zerosnd( [ 1, 1, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 2, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - expected = [ - [ - [ [ [] ] ], - [ [ [] ] ], - [ [ [] ] ] - ] - ]; - actual = zerosnd( [ 1, 3, 1, 1, 0 ] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -});