From 149ea34061243650bbcd36522a79746cf6a82448 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 22:23:50 +0000 Subject: [PATCH 01/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9932e66..2755435 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.0.2", "@stdlib/assert-is-array": "^0.0.7", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 0dca1b1f68161aedfdcc58406ea3fb52d738ddfc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 22:25:12 +0000 Subject: [PATCH 02/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 69 - 40 files changed, 6201 insertions(+), 3623 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.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 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 5e0f682..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/one-to) 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 9c989ad..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/one-to) 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 f49bc65..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -135,7 +128,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 2755435..695269d 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.0.2", - "@stdlib/assert-is-array": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/blas-ext-base-gsort2hp": "^0.0.10", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9d7b15b --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 3f27a433c18d241e1ea63144c76c85527f4afadf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:21:42 +0000 Subject: [PATCH 03/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9932e66..2755435 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.0.2", "@stdlib/assert-is-array": "^0.0.7", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 260d377f361c4afd28a73befd10159718e655921 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:22:09 +0000 Subject: [PATCH 04/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9d7b15b..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 336821b6006c6d69efbbe66f3cfa9cdaf24cb1b2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:23:20 +0000 Subject: [PATCH 05/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 69 - 40 files changed, 6201 insertions(+), 3623 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.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 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 5e0f682..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/one-to) 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 9c989ad..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/one-to) 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 f49bc65..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -144,7 +137,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 2755435..695269d 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.0.2", - "@stdlib/assert-is-array": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/blas-ext-base-gsort2hp": "^0.0.10", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..1e7ce80 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From dbff49844f74e7443d3ae11fa0424e9d3bcd146c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:34:17 +0000 Subject: [PATCH 06/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9932e66..2755435 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.0.2", "@stdlib/assert-is-array": "^0.0.7", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3c22e0a0d41be13c09e6df1d37183395cab7229a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:34:46 +0000 Subject: [PATCH 07/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 1e7ce80..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b673d6e38e82d57d6f8e4884348b504a17fbd9d1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:35:41 +0000 Subject: [PATCH 08/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 69 - 40 files changed, 6201 insertions(+), 3623 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.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 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 5e0f682..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/one-to) 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 9c989ad..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/one-to) 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 f49bc65..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -145,7 +138,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 2755435..695269d 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.0.2", - "@stdlib/assert-is-array": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/blas-ext-base-gsort2hp": "^0.0.10", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20cf995 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From e8b236b9dbc520a278852cb3801ebfe64f87c69e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:38:27 +0000 Subject: [PATCH 09/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9932e66..2755435 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.0.2", "@stdlib/assert-is-array": "^0.0.7", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3568022218f0132ebb4d41253ed08b867664fed6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:38:55 +0000 Subject: [PATCH 10/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 20cf995..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f1cdb3dd3113e550ad85b6d14f5d9b3962465c8f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:38:55 +0000 Subject: [PATCH 11/71] 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 | 39 +- benchmark/benchmark.js | 48 ++ benchmark/benchmark.length.js | 93 +++ branches.md | 53 ++ dist/index.d.ts | 3 + dist/index.js | 5 + dist/index.js.map | 7 + docs/repl.txt | 28 + docs/types/index.d.ts | 36 + docs/types/test.ts | 44 ++ examples/index.js | 39 ++ lib/index.js | 40 ++ lib/main.js | 50 ++ test/test.js | 69 ++ 36 files changed, 3604 insertions(+), 16 deletions(-) create mode 100644 .editorconfig create mode 100644 .eslintrc.js create mode 100644 .gitattributes create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/benchmark.yml create mode 100644 .github/workflows/cancel.yml create mode 100644 .github/workflows/close_pull_requests.yml create mode 100644 .github/workflows/examples.yml create mode 100644 .github/workflows/npm_downloads.yml create mode 100644 .github/workflows/productionize.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/test_bundles.yml create mode 100644 .github/workflows/test_coverage.yml create mode 100644 .github/workflows/test_install.yml create mode 100644 .gitignore create mode 100644 .npmignore create mode 100644 .npmrc create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 Makefile create mode 100644 benchmark/benchmark.js create mode 100644 benchmark/benchmark.length.js create mode 100644 branches.md create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 docs/repl.txt create mode 100644 docs/types/index.d.ts create mode 100644 docs/types/test.ts create mode 100644 examples/index.js create mode 100644 lib/index.js create mode 100644 lib/main.js create mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0fd4d6c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,181 @@ +#/ +# @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 new file mode 100644 index 0000000..5f30286 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1 @@ +/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..10a16e6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,49 @@ +#/ +# @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 new file mode 100644 index 0000000..5e0f682 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ + + +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/one-to) 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 new file mode 100644 index 0000000..06a9a75 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,62 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2021 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS 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 new file mode 100644 index 0000000..a00dbe5 --- /dev/null +++ b/.github/workflows/cancel.yml @@ -0,0 +1,56 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2021 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS 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 new file mode 100644 index 0000000..9c989ad --- /dev/null +++ b/.github/workflows/close_pull_requests.yml @@ -0,0 +1,44 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2021 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS 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/one-to) 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 new file mode 100644 index 0000000..7902a7d --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,62 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2021 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS 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 new file mode 100644 index 0000000..f49bc65 --- /dev/null +++ b/.github/workflows/npm_downloads.yml @@ -0,0 +1,108 @@ +#/ +# @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: '46 10 * * 3' + + # Allow the workflow to be manually run: + workflow_dispatch: + +# Workflow jobs: +jobs: + + # Define a job for retrieving npm download counts... + npm_downloads: + + # Define display name: + name: 'Retrieve npm download counts' + + # Define the type of virtual host machine on which to run the job: + runs-on: ubuntu-latest + + # Define the sequence of job steps... + steps: + # Checkout the repository: + - name: 'Checkout repository' + uses: actions/checkout@v3 + timeout-minutes: 10 + + # Install Node.js: + - name: 'Install Node.js' + uses: actions/setup-node@v3 + with: + node-version: 16 + timeout-minutes: 5 + + # Resolve package name: + - name: 'Resolve package name' + id: package_name + run: | + name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` + echo "package_name=$name" >> $GITHUB_OUTPUT + timeout-minutes: 5 + + # Fetch download data: + - name: 'Fetch data' + id: download_data + run: | + url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" + echo "$url" + data=$(curl "$url") + mkdir ./tmp + echo "$data" > ./tmp/npm_downloads.json + echo "data=$data" >> $GITHUB_OUTPUT + timeout-minutes: 5 + + # Print summary of download data: + - name: 'Print summary' + run: | + echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY + echo "|------|------------|" >> $GITHUB_STEP_SUMMARY + cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY + + # Upload the download data: + - name: 'Upload data' + uses: actions/upload-artifact@v3 + with: + # Define a name for the uploaded artifact (ensuring a unique name for each job): + name: npm_downloads + + # Specify the path to the file to upload: + path: ./tmp/npm_downloads.json + + # Specify the number of days to retain the artifact (default is 90 days): + retention-days: 90 + timeout-minutes: 10 + if: success() + + # Send data to events server: + - name: 'Post data' + uses: distributhor/workflow-webhook@v3 + env: + webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} + webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} + data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' + timeout-minutes: 5 + if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml new file mode 100644 index 0000000..91f2b93 --- /dev/null +++ b/.github/workflows/productionize.yml @@ -0,0 +1,783 @@ +#/ +# @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 - - ```
@@ -138,7 +145,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js new file mode 100644 index 0000000..ce0c484 --- /dev/null +++ b/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); +var pkg = require( './../package.json' ).name; +var oneTo = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var i; + var v; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = oneTo( 100 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isArray( v ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js new file mode 100644 index 0000000..bb7e021 --- /dev/null +++ b/benchmark/benchmark.length.js @@ -0,0 +1,93 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); +var pkg = require( './../package.json' ).name; +var oneTo = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = oneTo( len ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isArray( v ) ) { + b.fail( 'should return an array' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/branches.md b/branches.md new file mode 100644 index 0000000..94a0606 --- /dev/null +++ b/branches.md @@ -0,0 +1,53 @@ + + +# 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/one-to" +%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" +%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" +%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" +%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" +%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" +``` + +[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to +[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production +[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno +[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd +[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..51b28cd --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +/// +import oneTo from '../docs/types/index'; +export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..ccfdf91 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,5 @@ +"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ +function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", + "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] +} diff --git a/docs/repl.txt b/docs/repl.txt new file mode 100644 index 0000000..7c7d298 --- /dev/null +++ b/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( n ) + Generates a linearly spaced numeric array whose elements increment by 1 + starting from one. + + If `n` is a non-integer value greater than zero, the function returns an + array having `ceil(n)` elements. + + If `n` is less than or equal to zero, the function returns an empty array. + + Parameters + ---------- + n: number + Number of elements. + + Returns + ------- + out: Array + Linearly spaced numeric array. + + Examples + -------- + > var arr = {{alias}}( 6 ) + [ 1, 2, 3, 4, 5, 6 ] + + See Also + -------- + diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts new file mode 100644 index 0000000..ed36a1c --- /dev/null +++ b/docs/types/index.d.ts @@ -0,0 +1,36 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT 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 + +/** +* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. +* +* @param n - number of elements +* @returns linearly spaced numeric array +* +* @example +* var arr = oneTo( 6 ); +* // returns [ 1, 2, 3, 4, 5, 6 ] +*/ +declare function oneTo( n: number ): Array; + + +// EXPORTS // + +export = oneTo; diff --git a/docs/types/test.ts b/docs/types/test.ts new file mode 100644 index 0000000..7f60d41 --- /dev/null +++ b/docs/types/test.ts @@ -0,0 +1,44 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT 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 oneTo = require( './index' ); + + +// TESTS // + +// The function returns an array of numbers... +{ + oneTo( 11 ); // $ExpectType number[] +} + +// The compiler throws an error if the function is not provided a number... +{ + oneTo( true ); // $ExpectError + oneTo( false ); // $ExpectError + oneTo( '5' ); // $ExpectError + oneTo( [] ); // $ExpectError + oneTo( {} ); // $ExpectError + oneTo( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + oneTo(); // $ExpectError + oneTo( 3, 4 ); // $ExpectError + oneTo( 3, 4, 1 ); // $ExpectError +} diff --git a/examples/index.js b/examples/index.js new file mode 100644 index 0000000..e94ce58 --- /dev/null +++ b/examples/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR 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 sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); +var filledBy = require( '@stdlib/array-base-filled-by' ); +var randu = require( '@stdlib/random-base-randu' ); +var oneTo = require( './../lib' ); + +// Generate an array of random numbers: +var x = filledBy( 10, randu ); + +// Generate a linearly-spaced array: +var y = oneTo( x.length ); + +// Create a temporary array to avoid mutation: +var tmp = x.slice(); + +// Sort `y` according to the sort order of `x`: +sort2hp( x.length, 1, tmp, 1, y, 1 ); + +console.log( x ); +console.log( y ); diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..d582284 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. +* +* @module @stdlib/array-base-one-to +* +* @example +* var oneTo = require( '@stdlib/array-base-one-to' ); +* +* var arr = oneTo( 6 ); +* // returns [ 1, 2, 3, 4, 5, 6 ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/main.js b/lib/main.js new file mode 100644 index 0000000..d1c25c9 --- /dev/null +++ b/lib/main.js @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. +* +* @param {number} n - number of elements +* @returns {Array} linearly spaced numeric array +* +* @example +* var arr = oneTo( 6 ); +* // returns [ 1, 2, 3, 4, 5, 6 ] +*/ +function oneTo( n ) { + var arr; + var i; + + arr = []; + if ( n <= 0 ) { + return arr; + } + for ( i = 1; i < n+1; i++ ) { + arr.push( i ); + } + return arr; +} + + +// EXPORTS // + +module.exports = oneTo; diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..9911394 --- /dev/null +++ b/test/test.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF 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 oneTo = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a linearly spaced array', function test( t ) { + var expected; + var actual; + + actual = oneTo( 10 ); + expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + actual = oneTo( 5 ); + expected = [ 1, 2, 3, 4, 5 ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { + var expected; + var actual; + + actual = oneTo( 10.5 ); + expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + actual = oneTo( 5.0000001 ); + expected = [ 1, 2, 3, 4, 5, 6 ]; + t.deepEqual( actual, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { + t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); + t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); + t.end(); +}); From 853a832af2ea9a0b92f14f39b10f59c3f84f9b1d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 24 Aug 2023 23:40:11 +0000 Subject: [PATCH 12/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 69 - 40 files changed, 6201 insertions(+), 3623 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.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 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 5e0f682..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/one-to) 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 9c989ad..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/one-to) 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 f49bc65..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -145,7 +138,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 2755435..695269d 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.0.2", - "@stdlib/assert-is-array": "^0.0.7", - "@stdlib/bench": "^0.0.12", - "@stdlib/blas-ext-base-gsort2hp": "^0.0.10", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/random-base-randu": "^0.0.8", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c006b4b --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 30a239cd9156b1ba07c065431d8bdc41323ad109 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 06:35:57 +0000 Subject: [PATCH 13/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 28e01a8..3f4eafe 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.0.2", "@stdlib/assert-is-array": "^0.1.0", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3282e4fa3cda897065bf875b7dfb372a1529c95e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 08:43:33 +0000 Subject: [PATCH 14/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c006b4b..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 509d5b4758a030e90658cf2c22be23855f605dd3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 08:45:17 +0000 Subject: [PATCH 15/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 69 - 41 files changed, 6201 insertions(+), 3658 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 9c989ad..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/one-to) 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 f49bc65..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -146,7 +139,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 3f4eafe..eaf6b40 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.0.2", - "@stdlib/assert-is-array": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gsort2hp": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-randu": "^0.0.8", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f580153 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From a238b76ea4d191c865f8fc83f1c3d24a455fe373 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 10:28:28 +0000 Subject: [PATCH 16/71] Update README.md for ESM bundle v0.1.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 137243c..c2a5e7a 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ limitations under the License. ## Usage ```javascript -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.1.0-esm/index.mjs'; ``` #### oneTo( n ) @@ -96,7 +96,7 @@ var arr = oneTo( 5.1 ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.1.0-esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From 4bf54bd9c30b5ea6a79bb3dec02154fcdfeff21e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 10:28:29 +0000 Subject: [PATCH 17/71] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c2a5e7a..d8f7ea1 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-one-to/tags). For example, + ```javascript import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.1.0-esm/index.mjs'; ``` @@ -96,7 +101,7 @@ var arr = oneTo( 5.1 ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.1.0-esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From 05418c7f29738fbb11d580a354a0325ddf4a4ed4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Oct 2023 14:14:27 +0000 Subject: [PATCH 18/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 16525c0..be49210 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.1.0", "@stdlib/assert-is-array": "^0.1.0", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c4e80ada9cc2d0b1d6ef74038b54deb4af438ca9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 22:24:52 +0000 Subject: [PATCH 19/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index f580153..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d79d7c83edc753ae084520428b09ff36b70e1362 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 22:28:29 +0000 Subject: [PATCH 20/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 69 - test/test.js | 69 - 43 files changed, 6201 insertions(+), 3786 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index b0f2155..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T04:21:06.943Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 759078c..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -146,7 +139,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index be49210..eaf6b40 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.1.0", - "@stdlib/assert-is-array": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gsort2hp": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..30425e9 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 89486db..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 505c3d268fdb6045aba06d9594b05c764d0a2861 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 17:40:47 +0000 Subject: [PATCH 21/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bcdac6d..b27ffd6 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.1.0", "@stdlib/assert-is-array": "^0.1.1", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ec6e1c67248f4b42aef47fd325c1ae6cfccd9db7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 23:32:38 +0000 Subject: [PATCH 22/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 30425e9..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 480608c57d1aef7e4fcffbd10007b3c545cf631f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 23:36:50 +0000 Subject: [PATCH 23/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 69 - test/test.js | 69 - 42 files changed, 6201 insertions(+), 3785 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 759078c..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -146,7 +139,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index b27ffd6..eaf6b40 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.1.0", - "@stdlib/assert-is-array": "^0.1.1", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gsort2hp": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..48dc70c --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 89486db..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From ed2a7a342306763a8e0ac0bec11517a0450c010d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Nov 2023 15:15:12 +0000 Subject: [PATCH 24/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bcdac6d..b27ffd6 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.1.0", "@stdlib/assert-is-array": "^0.1.1", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 836c1cf4025f94b52678926a211c3ca525159938 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 22:31:15 +0000 Subject: [PATCH 25/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 48dc70c..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 482242b745c8632d7cf3dc7efb0ff9c0ec9d2862 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 22:34:38 +0000 Subject: [PATCH 26/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 69 - 43 files changed, 6201 insertions(+), 3758 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index b0bc9ee..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T04:36:13.741Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 759078c..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -146,7 +139,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index b27ffd6..eaf6b40 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.1.0", - "@stdlib/assert-is-array": "^0.1.1", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gsort2hp": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c0ba3eb --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 8ffbb99bfc9ef94cb1e6bf4acfa86b50f3dc853a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 11:35:44 +0000 Subject: [PATCH 27/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d8b1901..c5ac654 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.1.0", "@stdlib/assert-is-array": "^0.1.1", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c08eb8e7cdfae45aa44a19d28f72b26fa73e9b06 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:44:00 +0000 Subject: [PATCH 28/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c0ba3eb..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2e0d3a4162dbd116b429d618feb5c234fa7ddf5d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:46:21 +0000 Subject: [PATCH 29/71] 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 | 39 +- benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 69 - 43 files changed, 6201 insertions(+), 3753 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 1ce209a..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T04:47:02.747Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 759078c..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -146,7 +139,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ce0c484..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index bb7e021..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..fe16cd4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index c5ac654..eaf6b40 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.1.0", - "@stdlib/assert-is-array": "^0.1.1", - "@stdlib/bench": "^0.2.1", - "@stdlib/blas-ext-base-gsort2hp": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..da38986 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 762a81a73c32af98c30d67cadfa07e15de673e62 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 06:52:43 +0000 Subject: [PATCH 30/71] Transform error messages --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0d20e07..329739e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": {}, + "dependencies": { + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" + }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.1.0", "@stdlib/assert-is-array": "^0.1.1", @@ -80,4 +82,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 9be233b7b42b04e4bf7eea6f340e6dfee02baadf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:36:45 +0000 Subject: [PATCH 31/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index fe16cd4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index da38986..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From cdf75b2a4f579f990b6d8efb7147fc8424db0731 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:37:03 +0000 Subject: [PATCH 32/71] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 48 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 44 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 50 - package.json | 58 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 69 - 44 files changed, 6201 insertions(+), 3759 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index be1ba3c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T04:13:25.943Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 f219feb..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -146,7 +139,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 62cc391..0000000 --- a/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ccfdf91..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=u(function(c,i){ -function o(e){var r,t;if(r=[],e<=0)return r;for(t=1;t} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\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,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACAC,EAGJ,GADAD,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAI,KAAMC,CAAE,EAEb,OAAOD,CACR,CAKAH,EAAO,QAAUC,ICfjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 7c7d298..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7f60d41..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..1355ad4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index d582284..0000000 --- a/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 329739e..eaf6b40 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.1.0", - "@stdlib/assert-is-array": "^0.1.1", - "@stdlib/blas-ext-base-gsort2hp": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -82,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ea72ff2 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 3b71ecd5cd61416116d77b7e5f64b0715f19a31f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jan 2024 21:24:49 +0000 Subject: [PATCH 33/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f4cfc45..eef4bd1 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.1.0", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From eda646f11dd917a28a257edf7145163dd21ff10c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jan 2024 21:25:17 +0000 Subject: [PATCH 34/71] Remove files --- index.d.ts | 36 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6218 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index ed36a1c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -declare function oneTo( n: number ): Array; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 1355ad4..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,u;if(t=[],r<=0)return t;for(u=1;u} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n"],"names":["oneTo","n","arr","i","push"],"mappings":";;AAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ea72ff2..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From fba366036fc84c190d6afef59924284054cd21ec Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jan 2024 21:25:58 +0000 Subject: [PATCH 35/71] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 47 files changed, 6208 insertions(+), 4456 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 f219feb..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -160,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 94a0606..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 1a03b37..0e0be72 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..7184e15 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.1.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.1.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index eef4bd1..eaf6b40 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.1.0", - "@stdlib/array-base-assert-is-complex128array": "^0.1.0", - "@stdlib/array-base-assert-is-complex64array": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.1.0", - "@stdlib/array-base-to-accessor-array": "^0.1.0", - "@stdlib/array-base-zeros": "^0.1.1", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-has-own-property": "^0.1.1", - "@stdlib/assert-is-array": "^0.1.1", - "@stdlib/assert-is-same-complex128array": "github:stdlib-js/assert-is-same-complex128array#main", - "@stdlib/assert-is-same-complex64array": "github:stdlib-js/assert-is-same-complex64array#main", - "@stdlib/assert-is-same-float64array": "github:stdlib-js/assert-is-same-float64array#main", - "@stdlib/blas-ext-base-gsort2hp": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-randu": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..6ced536 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From faaa808116dfb86311d20da506d92f9ba228c6aa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 02:43:34 +0000 Subject: [PATCH 36/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c64339b..2996e2d 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.0", "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", "@stdlib/types": "^0.3.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.1.0", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3d34406d88bfbd35c9cfa1d0bb18e6af5da38d42 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 06:27:45 +0000 Subject: [PATCH 37/71] Remove files --- index.d.ts | 361 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6543 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 0e0be72..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-real' ); - * var imag = require( '@stdlib/complex-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-realf' ); - * var imagf = require( '@stdlib/complex-imagf' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7184e15..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.1.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.1.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 6ced536..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a56a7ca158365c393f672cc515059e6dbce0e301 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 06:28:55 +0000 Subject: [PATCH 38/71] 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 | 47 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 47 files changed, 6208 insertions(+), 4465 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 b864c9e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -162,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 1a03b37..0e0be72 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..4985517 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.0-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.1.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 2996e2d..0e167ab 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.0", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.0", - "@stdlib/array-base-assert-is-complex128array": "^0.2.0", - "@stdlib/array-base-assert-is-complex64array": "^0.2.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.0", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", - "@stdlib/types": "^0.3.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.1.0", - "@stdlib/array-base-to-accessor-array": "^0.1.0", - "@stdlib/array-base-zeros": "^0.2.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.2.0", - "@stdlib/assert-has-own-property": "^0.2.0", - "@stdlib/assert-is-array": "^0.2.0", - "@stdlib/assert-is-same-complex128array": "^0.1.0", - "@stdlib/assert-is-same-complex64array": "^0.1.0", - "@stdlib/assert-is-same-float64array": "^0.1.0", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.2.0", - "@stdlib/random-base-randu": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4ca31ff --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 8b0b963089c083ee3fb67ae648bcf7cbe015698c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 06:52:02 +0000 Subject: [PATCH 39/71] Update README.md for ESM bundle v0.2.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f1120c7..c721538 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ limitations under the License. ## Usage ```javascript -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.0-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.0-esm/index.mjs'; ``` #### oneTo( n ) @@ -116,7 +116,7 @@ var bool = ( arr === out ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.0-esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From a5a29933d2e288aefbc4c764db15a84ce64525ee Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 06:52:03 +0000 Subject: [PATCH 40/71] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c721538..86485fb 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-one-to/tags). For example, + ```javascript import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.0-esm/index.mjs'; ``` @@ -48,7 +53,7 @@ import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2. You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.0-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; ``` #### oneTo( n ) @@ -116,7 +121,7 @@ var bool = ( arr === out ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.0-esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From 0f2f1f5559fa89116708ae16316e928d12dfc829 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:57:46 +0000 Subject: [PATCH 41/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 233a944..e463b26 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.1", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3d14da89d54cf51003aa2f12ad254215e8197dba Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:18:24 +0000 Subject: [PATCH 42/71] Remove files --- index.d.ts | 361 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6543 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 0e0be72..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-real' ); - * var imag = require( '@stdlib/complex-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-realf' ); - * var imagf = require( '@stdlib/complex-imagf' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 4985517..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.0-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.1.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4ca31ff..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8559ef38cd27c2602efc6bc33cc585edd0ceb7bb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:18:53 +0000 Subject: [PATCH 43/71] 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 | 47 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 47 files changed, 4873 insertions(+), 4459 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -162,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 1a03b37..0e0be72 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0a45576 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index e463b26..6d1fea7 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.1", - "@stdlib/array-base-assert-is-complex64array": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.1", - "@stdlib/array-base-to-accessor-array": "^0.2.0", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex128": "^0.2.0", - "@stdlib/array-complex64": "^0.2.0", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-same-complex128array": "^0.2.0", - "@stdlib/assert-is-same-complex64array": "^0.2.0", - "@stdlib/assert-is-same-float64array": "^0.2.0", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c7d5ebd --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 3250a036d4b5ddd8d2991662e7dba291e2feadae Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:33:50 +0000 Subject: [PATCH 44/71] Update README.md for ESM bundle v0.2.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6607173..a044871 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ limitations under the License. ## Usage ```javascript -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.1-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.1-esm/index.mjs'; ``` #### oneTo( n ) @@ -116,7 +116,7 @@ var bool = ( arr === out ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.1-esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From d69097445fabd540cf0cbfe7b7ca040f4a569ad7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:33:51 +0000 Subject: [PATCH 45/71] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a044871..4e37865 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-one-to/tags). For example, + ```javascript import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.1-esm/index.mjs'; ``` @@ -48,7 +53,7 @@ import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2. You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.1-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; ``` #### oneTo( n ) @@ -116,7 +121,7 @@ var bool = ( arr === out ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.1-esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From d45290bd33587b984fac1a244e10ae493d12f49f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 08:29:20 +0000 Subject: [PATCH 46/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f692f86..6bfc3a4 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.1", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8eda83989cae78e67e61013d7093a602ebfe63b9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 14:08:30 +0000 Subject: [PATCH 47/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 0e0be72..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-real' ); - * var imag = require( '@stdlib/complex-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-realf' ); - * var imagf = require( '@stdlib/complex-imagf' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0a45576..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c7d5ebd..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3955a8caaebde552ad2c8ebf96f0b25292a41d2c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 14:08:46 +0000 Subject: [PATCH 48/71] 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 | 47 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 48 files changed, 4873 insertions(+), 4464 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 38d403b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T05:53:04.987Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -162,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 1a03b37..0e0be72 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0a45576 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 6bfc3a4..6d1fea7 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.1", - "@stdlib/array-base-assert-is-complex64array": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.1", - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-same-complex128array": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/assert-is-same-float64array": "^0.2.1", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c7d5ebd --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From abdc4c26e1354aef53b82e9e902789d08a5350e2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 04:37:49 +0000 Subject: [PATCH 49/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f692f86..6bfc3a4 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.1", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 5acdd0dd6323fec01f12b0f8c29cccaef0d9b4b8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 10:22:51 +0000 Subject: [PATCH 50/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 0e0be72..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-real' ); - * var imag = require( '@stdlib/complex-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-realf' ); - * var imagf = require( '@stdlib/complex-imagf' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0a45576..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c7d5ebd..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2f39466ac32a3ded19b29d7d66112d71ff1312bf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 10:23:10 +0000 Subject: [PATCH 51/71] 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 | 47 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 47 files changed, 4873 insertions(+), 4465 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -162,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 1a03b37..0e0be72 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0a45576 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 6bfc3a4..6d1fea7 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.1", - "@stdlib/array-base-assert-is-complex64array": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.1", - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-same-complex128array": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/assert-is-same-float64array": "^0.2.1", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c7d5ebd --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From cfac7292123e0eadd8bae70236cd65e286404e18 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 17 Jul 2024 03:27:01 +0000 Subject: [PATCH 52/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f692f86..6bfc3a4 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.1", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8f267bd04a021b63de23f2c64b30308a8b326008 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 17 Jul 2024 03:29:04 +0000 Subject: [PATCH 53/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 0e0be72..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-real' ); - * var imag = require( '@stdlib/complex-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-realf' ); - * var imagf = require( '@stdlib/complex-imagf' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0a45576..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c7d5ebd..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6336503f07998871452adb88966453df778fecc1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 17 Jul 2024 03:29:30 +0000 Subject: [PATCH 54/71] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 86 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 47 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 47 files changed, 4873 insertions(+), 4557 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 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 + + ```
@@ -162,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 12613f8..241215f 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0a45576 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 6bfc3a4..6d1fea7 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.1", - "@stdlib/array-base-assert-is-complex64array": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.1", - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-same-complex128array": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/assert-is-same-float64array": "^0.2.1", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c7d5ebd --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From c7f819bd66adc47cbf522ac2f38d9ab41075cfe7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 17 Jul 2024 10:17:06 +0000 Subject: [PATCH 55/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f692f86..6bfc3a4 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.1", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 65fee6744b1fa6b482127b84ccabad177ad473da Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 17 Jul 2024 10:19:16 +0000 Subject: [PATCH 56/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 241215f..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-float32-real' ); - * var imagf = require( '@stdlib/complex-float32-imag' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0a45576..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c7d5ebd..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0cd59bf318aa558ab653a3f5fc57672007f080ad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 17 Jul 2024 10:19:46 +0000 Subject: [PATCH 57/71] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 87 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 47 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 47 files changed, 4873 insertions(+), 4558 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 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 + + ```
@@ -162,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 0b249de..fed24af 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0a45576 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 6bfc3a4..6d1fea7 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.1", - "@stdlib/array-base-assert-is-complex64array": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.0", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.1", - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-same-complex128array": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/assert-is-same-float64array": "^0.2.1", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c7d5ebd --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From d2dacb1a9e72ca5937c118b21bde1b6d25d63a78 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 11:56:30 +0000 Subject: [PATCH 58/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index af86ed4..5f1b0fd 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.2", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From dca37c4eb79e376106165311fc8e17bd21d0d6cb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 11:57:47 +0000 Subject: [PATCH 59/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index fed24af..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-float32-real' ); - * var imagf = require( '@stdlib/complex-float32-imag' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0a45576..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c7d5ebd..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d0e31da7c99abb11dadec4dc8a5cbc7fa3a5b1a9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 11:58:06 +0000 Subject: [PATCH 60/71] 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 | 149 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 47 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 47 files changed, 4873 insertions(+), 4622 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -162,7 +159,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 0b249de..fed24af 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b20e3c6 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 5f1b0fd..2703348 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.2", - "@stdlib/array-base-assert-is-complex64array": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.2", - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-same-complex128array": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/assert-is-same-float64array": "^0.2.1", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..3874c9f --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From e9d9c46cdcbe76d5bed42b0c1b265b1e0124863d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 11:58:36 +0000 Subject: [PATCH 61/71] Update README.md for ESM bundle v0.2.2 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 77b2ce1..fb87db4 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ limitations under the License. ## Usage ```javascript -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.2-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.2-esm/index.mjs'; ``` #### oneTo( n ) @@ -116,7 +116,7 @@ var bool = ( arr === out ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.2-esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From b6d770ab2ba490dcc4cbfb712d06b78c13bb86cf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 11:58:37 +0000 Subject: [PATCH 62/71] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb87db4..ba3b990 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-one-to/tags). For example, + ```javascript import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.2-esm/index.mjs'; ``` @@ -48,7 +53,7 @@ import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2. You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.2-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; ``` #### oneTo( n ) @@ -116,7 +121,7 @@ var bool = ( arr === out ); import sort2hp from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gsort2hp@esm/index.mjs'; import filledBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled-by@esm/index.mjs'; import randu from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-randu@esm/index.mjs'; -import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@v0.2.2-esm/index.mjs'; +import oneTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-one-to@esm/index.mjs'; // Generate an array of random numbers: var x = filledBy( 10, randu ); From 163f8caaccf730b65dbd731aef2306ea10960061 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 12 Dec 2024 03:07:54 +0000 Subject: [PATCH 63/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f525cad..27410fb 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.2", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e062a92ea53e702bcf9e1ade2db076db25b3d2b6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 12 Dec 2024 03:08:23 +0000 Subject: [PATCH 64/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index fed24af..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-float32-real' ); - * var imagf = require( '@stdlib/complex-float32-imag' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b20e3c6..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 3874c9f..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2d1e8375266dcc46760565eb82ded8e2a953791f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 12 Dec 2024 03:08:45 +0000 Subject: [PATCH 65/71] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 171 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 51 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 48 files changed, 4875 insertions(+), 4751 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -169,7 +166,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -234,9 +231,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zero-to]: https://github.com/stdlib-js/array-base-zero-to +[@stdlib/array/base/zero-to]: https://github.com/stdlib-js/array-base-zero-to/tree/esm -[@stdlib/array/base/ones]: https://github.com/stdlib-js/array-base-ones +[@stdlib/array/base/ones]: https://github.com/stdlib-js/array-base-ones/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 0b249de..fed24af 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b20e3c6 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 27410fb..2703348 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.2", - "@stdlib/array-base-assert-is-complex64array": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.2", - "@stdlib/array-base-to-accessor-array": "^0.2.2", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-same-complex128array": "^0.2.2", - "@stdlib/assert-is-same-complex64array": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..3874c9f --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From ee44fb5dbe01ca475380c7cf377fb0c7a9468886 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 20 Jan 2025 01:52:50 +0000 Subject: [PATCH 66/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f525cad..27410fb 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.2", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 2d26e0ed9c20c92c65f00591d8af0f4fda6ec88e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 20 Jan 2025 02:09:39 +0000 Subject: [PATCH 67/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index fed24af..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-float32-real' ); - * var imagf = require( '@stdlib/complex-float32-imag' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b20e3c6..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 3874c9f..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 775b18632437cc6419758db0afe53292720b47d6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 20 Jan 2025 02:09:55 +0000 Subject: [PATCH 68/71] 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 | 171 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 51 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 49 files changed, 4875 insertions(+), 4751 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 1bf7697..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-01-20T01:46:19.136Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5e0f682..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -169,7 +166,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -234,9 +231,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zero-to]: https://github.com/stdlib-js/array-base-zero-to +[@stdlib/array/base/zero-to]: https://github.com/stdlib-js/array-base-zero-to/tree/esm -[@stdlib/array/base/ones]: https://github.com/stdlib-js/array-base-ones +[@stdlib/array/base/ones]: https://github.com/stdlib-js/array-base-ones/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 0b249de..fed24af 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..496818b --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 27410fb..2703348 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.2", - "@stdlib/array-base-assert-is-complex64array": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.2", - "@stdlib/array-base-to-accessor-array": "^0.2.2", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-same-complex128array": "^0.2.2", - "@stdlib/assert-is-same-complex64array": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..3874c9f --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -}); From 98132ca682cfc11febdf3e36c091515e78587ebe Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 01:55:24 +0000 Subject: [PATCH 69/71] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f525cad..27410fb 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled-by": "^0.2.2", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 40442d121d71c3b36382d2d7f6237b18b85fc921 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 02:11:43 +0000 Subject: [PATCH 70/71] Remove files --- index.d.ts | 361 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5208 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index fed24af..0000000 --- a/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; - -/** -* Interface describing `oneTo`. -*/ -interface ZeroTo { - /** - * Generates a linearly spaced numeric array whose elements increment by 1 starting from one. - * - * @param n - number of elements - * @returns linearly spaced numeric array - * - * @example - * var arr = oneTo( 6 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - ( n: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float64Array = require( '@stdlib/array-float64' ); - * - * var out = new Float64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float64Array, stride: number, offset: number ): Float64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Float32Array = require( '@stdlib/array-float32' ); - * - * var out = new Float32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] - */ - assign( out: Float32Array, stride: number, offset: number ): Float32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int32Array = require( '@stdlib/array-int32' ); - * - * var out = new Int32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int32Array, stride: number, offset: number ): Int32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int16Array = require( '@stdlib/array-int16' ); - * - * var out = new Int16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int16Array, stride: number, offset: number ): Int16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Int8Array = require( '@stdlib/array-int8' ); - * - * var out = new Int8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Int8Array, stride: number, offset: number ): Int8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint32Array = require( '@stdlib/array-uint32' ); - * - * var out = new Uint32Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint32Array, stride: number, offset: number ): Uint32Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint16Array = require( '@stdlib/array-uint16' ); - * - * var out = new Uint16Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint16Array, stride: number, offset: number ): Uint16Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8Array = require( '@stdlib/array-uint8' ); - * - * var out = new Uint8Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8Array, stride: number, offset: number ): Uint8Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); - * - * var out = new Uint8ClampedArray( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - */ - assign( out: Uint8ClampedArray, stride: number, offset: number ): Uint8ClampedArray; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array-complex128' ); - * var real = require( '@stdlib/complex-float64-real' ); - * var imag = require( '@stdlib/complex-float64-imag' ); - * - * var out = new Complex128Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = real( v ); - * // returns 6.0 - * - * var im = imag( v ); - * // returns 0.0 - */ - assign( out: Complex128Array, stride: number, offset: number ): Complex128Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var Complex64Array = require( '@stdlib/array-complex64' ); - * var realf = require( '@stdlib/complex-float32-real' ); - * var imagf = require( '@stdlib/complex-float32-imag' ); - * - * var out = new Complex64Array( 6 ); - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns - * - * var re = realf( v ); - * // returns 6.0 - * - * var im = imagf( v ); - * // returns 0.0 - */ - assign( out: Complex64Array, stride: number, offset: number ): Complex64Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); - * - * var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); - * var arr = oneTo.assign( out, 1, 0 ); - * - * var bool = ( arr === out ); - * // returns true - * - * var v = out.get( out.length-1 ); - * // returns 6 - */ - assign( out: AccessorArrayLike, stride: number, offset: number ): AccessorArrayLike; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Array, stride: number, offset: number ): Array; - - /** - * Fills an array with linearly spaced numeric elements which increment by 1 starting from one. - * - * @param out - output array - * @param stride - output array stride - * @param offset - output array index offset - * @returns output array - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, 1, 0 ); - * // returns [ 1, 2, 3, 4, 5, 6 ] - * - * @example - * var out = [ 0, 0, 0, 0, 0, 0 ]; - * - * var arr = oneTo.assign( out, -1, out.length-1 ); - * // returns [ 6, 5, 4, 3, 2, 1 ] - */ - assign( out: Collection, stride: number, offset: number ): Collection; -} - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param n - number of elements -* @returns linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = oneTo.assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -declare var oneTo: ZeroTo; - - -// EXPORTS // - -export = oneTo; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 496818b..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 3874c9f..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7d06c83a070a3fded659e3160b41102bb0046e2c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 7 Apr 2025 02:12:02 +0000 Subject: [PATCH 71/71] 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 | 171 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 51 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 95 - benchmark/benchmark.js | 71 - benchmark/benchmark.length.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 8 - dist/index.js.map | 7 - docs/repl.txt | 56 - docs/types/test.ts | 110 - examples/index.js | 39 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 198 - lib/index.js | 57 - lib/main.js | 50 - package.json | 74 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 211 - test/test.js | 40 - test/test.main.js | 69 - 49 files changed, 4875 insertions(+), 4755 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (99%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index ef0a062..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-04-07T01:40:10.150Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 349b1a3..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/one-to) 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 dfe56b0..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/one-to) 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 438a61e..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: '46 10 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -169,7 +166,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -234,9 +231,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/base/zero-to]: https://github.com/stdlib-js/array-base-zero-to +[@stdlib/array/base/zero-to]: https://github.com/stdlib-js/array-base-zero-to/tree/esm -[@stdlib/array/base/ones]: https://github.com/stdlib-js/array-base-ones +[@stdlib/array/base/ones]: https://github.com/stdlib-js/array-base-ones/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index 79dc7bc..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var out = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 25a1987..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isArray = require( '@stdlib/assert-is-array' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var i; - var v; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( 100 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':assign', function benchmark( b ) { - var out; - var i; - var v; - - out = zeros( 100 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo.assign( out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 52fbb46..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var oneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = oneTo( len ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0e27952..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/one-to" -%% click B href "https://github.com/stdlib-js/array-base-one-to/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-one-to/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-one-to/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-one-to/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-one-to/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/one-to -[production-url]: https://github.com/stdlib-js/array-base-one-to/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-one-to/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-one-to/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-one-to/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-one-to/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-one-to/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-one-to/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 51b28cd..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import oneTo from '../docs/types/index'; -export = oneTo; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5bf78b7..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict";var t=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var u=t(function(O,c){ -function h(r){var e,i;if(e=[],r<=0)return e;for(i=1;i=0&&n=0&&s=0&&s} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = oneTo;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' );\nvar isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* var Complex128Array = require( '@stdlib/array-complex128' );\n* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var oneTo = require( '@stdlib/array-base-one-to' );\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgCA,SAASC,EAAOC,EAAI,CACnB,IAAIC,EACA,EAGJ,GADAA,EAAM,CAAC,EACFD,GAAK,EACT,OAAOC,EAER,IAAM,EAAI,EAAG,EAAID,EAAE,EAAG,IACrBC,EAAI,KAAM,CAAE,EAEb,OAAOA,CACR,CAKAH,EAAO,QAAUC,ICjDjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,8CAA+C,EAC5EC,EAAmB,QAAS,6CAA8C,EAC1EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAiB,QAAS,6CAA8C,EACxEC,EAAgB,QAAS,4CAA6C,EA0B1E,SAASC,EAASC,EAAKC,EAAQC,EAAS,CACvC,IAAIC,EACAC,EAIJ,IAFAA,EAAIF,EACJC,EAAI,EACIC,GAAK,GAAKA,EAAIJ,EAAI,QACzBA,EAAKI,CAAE,EAAID,EACXC,GAAKH,EACLE,GAAK,EAEN,OAAOH,CACR,CA+BA,SAASK,EAASL,EAAKM,EAAML,EAAQC,EAAS,CAC7C,IAAIC,EACAI,EACAH,EAKJ,IAHAG,EAAIN,EAAS,EACbG,EAAIF,EAAS,EACbC,EAAI,EACIC,GAAK,GAAKA,EAAIE,EAAK,QAC1BA,EAAMF,CAAE,EAAID,EACZG,EAAMF,EAAE,CAAE,EAAI,EACdA,GAAKG,EACLJ,GAAK,EAEN,OAAOH,CACR,CA2BA,SAASQ,EAAWR,EAAKC,EAAQC,EAAS,CACzC,IAAII,EACAG,EACA,EACAL,EAOJ,IALAE,EAAON,EAAI,KACXS,EAAMT,EAAI,UAAW,CAAE,EAEvBI,EAAIF,EACJ,EAAI,EACIE,GAAK,GAAKA,EAAIE,EAAK,QAC1BG,EAAKH,EAAMF,EAAG,CAAE,EAChBA,GAAKH,EACL,GAAK,EAEN,OAAOK,CACR,CAyBA,SAASI,EAAQV,EAAKC,EAAQC,EAAS,CACtC,IAAIS,EAAMf,EAAkBI,CAAI,EAChC,OAAKW,EAAI,iBAEHjB,EAAmBM,CAAI,EACpBK,EAASL,EAAKH,EAAgBG,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAE1DP,EAAkBK,CAAI,EACnBK,EAASL,EAAKF,EAAeE,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAEvDM,EAAWG,EAAKV,EAAQC,CAAO,EAEhCH,EAASC,EAAKC,EAAQC,CAAO,CACrC,CAKAT,EAAO,QAAUiB,ICzJjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "oneTo", "n", "arr", "require_assign", "__commonJSMin", "exports", "module", "isComplex128Array", "isComplex64Array", "arraylike2object", "reinterpret128", "reinterpret64", "indexed", "out", "stride", "offset", "v", "i", "complex", "data", "s", "accessors", "set", "assign", "obj", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06ac994..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( n ) - Generates a linearly spaced numeric array whose elements increment by 1 - starting from one. - - If `n` is a non-integer value greater than zero, the function returns an - array having `ceil(n)` elements. - - If `n` is less than or equal to zero, the function returns an empty array. - - Parameters - ---------- - n: number - Number of elements. - - Returns - ------- - out: Array - Linearly spaced numeric array. - - Examples - -------- - > var arr = {{alias}}( 6 ) - [ 1, 2, 3, 4, 5, 6 ] - - -{{alias}}.assign( out, stride, offset ) - Fills an array with linearly spaced numeric elements which increment by 1 - starting from one. - - Parameters - ---------- - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array index offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var out = [ 0, 0, 0, 0, 0, 0 ]; - > {{alias}}.assign( out, -1, out.length-1 ); - > out - [ 6, 5, 4, 3, 2, 1 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index e1d6a07..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 Complex128Array = require( '@stdlib/array-complex128' ); -import Complex64Array = require( '@stdlib/array-complex64' ); -import oneTo = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - oneTo( 11 ); // $ExpectType number[] -} - -// The compiler throws an error if the function is not provided a number... -{ - oneTo( true ); // $ExpectError - oneTo( false ); // $ExpectError - oneTo( '5' ); // $ExpectError - oneTo( [] ); // $ExpectError - oneTo( {} ); // $ExpectError - oneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - oneTo(); // $ExpectError - oneTo( 3, 4 ); // $ExpectError - oneTo( 3, 4, 1 ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a collection... -{ - oneTo.assign( [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[] - oneTo.assign( new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array - oneTo.assign( new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array - oneTo.assign( new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array - oneTo.assign( new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array - oneTo.assign( new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array - oneTo.assign( new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array - oneTo.assign( new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array - oneTo.assign( new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array - oneTo.assign( new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray - oneTo.assign( new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array - oneTo.assign( new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object... -{ - oneTo.assign( 1, 1, 0 ); // $ExpectError - oneTo.assign( true, 1, 0 ); // $ExpectError - oneTo.assign( false, 1, 0 ); // $ExpectError - oneTo.assign( null, 1, 0 ); // $ExpectError - oneTo.assign( void 0, 1, 0 ); // $ExpectError - oneTo.assign( {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, '1', 0 ); // $ExpectError - oneTo.assign( out, true, 0 ); // $ExpectError - oneTo.assign( out, false, 0 ); // $ExpectError - oneTo.assign( out, null, 0 ); // $ExpectError - oneTo.assign( out, void 0, 0 ); // $ExpectError - oneTo.assign( out, {}, 0 ); // $ExpectError - oneTo.assign( out, [], 0 ); // $ExpectError - oneTo.assign( out, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not a number... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign( out, 1, '1' ); // $ExpectError - oneTo.assign( out, 1, true ); // $ExpectError - oneTo.assign( out, 1, false ); // $ExpectError - oneTo.assign( out, 1, null ); // $ExpectError - oneTo.assign( out, 1, void 0 ); // $ExpectError - oneTo.assign( out, 1, {} ); // $ExpectError - oneTo.assign( out, 1, [] ); // $ExpectError - oneTo.assign( out, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const out = [ 0, 0, 0, 0 ]; - - oneTo.assign(); // $ExpectError - oneTo.assign( out ); // $ExpectError - oneTo.assign( out, 1 ); // $ExpectError - oneTo.assign( out, 1, 0, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index e94ce58..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sort2hp = require( '@stdlib/blas-ext-base-gsort2hp' ); -var filledBy = require( '@stdlib/array-base-filled-by' ); -var randu = require( '@stdlib/random-base-randu' ); -var oneTo = require( './../lib' ); - -// Generate an array of random numbers: -var x = filledBy( 10, randu ); - -// Generate a linearly-spaced array: -var y = oneTo( x.length ); - -// Create a temporary array to avoid mutation: -var tmp = x.slice(); - -// Sort `y` according to the sort order of `x`: -sort2hp( x.length, 1, tmp, 1, y, 1 ); - -console.log( x ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 99% rename from docs/types/index.d.ts rename to index.d.ts index 0b249de..fed24af 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..496818b --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex128array@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex64array@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex64@v0.2.0-esm/index.mjs";function o(r){var e,s;if(e=[],r<=0)return e;for(s=1;s=0&&o=0&&o=0&&n} linearly spaced numeric array\n*\n* @example\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction oneTo( n ) {\n\tvar arr;\n\tvar i;\n\n\tarr = [];\n\tif ( n <= 0 ) {\n\t\treturn arr;\n\t}\n\tfor ( i = 1; i < n+1; i++ ) {\n\t\tarr.push( i );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default oneTo;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport arraylike2object from '@stdlib/array-base-arraylike2object';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\n\n\n// FUNCTIONS //\n\n/**\n* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = indexed( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction indexed( out, stride, offset ) {\n\tvar v;\n\tvar i;\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < out.length ) {\n\t\tout[ i ] = v;\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn out;\n}\n\n/**\n* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {(Complex128Array|Complex64Array)} out - output complex number array\n* @param {(Float64Array|Float32Array)} data - output array data\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {(Complex128Array|Complex64Array)} output array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\n*\n* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );\n* // returns \n*\n* var data = reinterpret128( out, 0 );\n* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]\n*\n* var arr = complex( out, data, 1, 0 );\n* // returns \n*\n* var bool = ( arr === out );\n* // returns true\n*\n* data = reinterpret128( out, 0 );\n* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]\n*/\nfunction complex( out, data, stride, offset ) {\n\tvar v;\n\tvar s;\n\tvar i;\n\n\ts = stride * 2;\n\ti = offset * 2;\n\tv = 1.0;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tdata[ i ] = v; // real component\n\t\tdata[ i+1 ] = 0.0; // imaginary component\n\t\ti += s;\n\t\tv += 1.0;\n\t}\n\treturn out;\n}\n\n/**\n* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @private\n* @param {Object} out - output array object\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import toAccessorArray from '@stdlib/array-base-to-accessor-array';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n\n* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] );\n* var arr = accessors( arraylike2object( out ), 1, 0 );\n*\n* var bool = ( arr === out );\n* // returns true\n*\n* var v = out.get( 0 );\n* // returns 1\n*\n* v = out.get( out.length-1 );\n* // returns 6\n*/\nfunction accessors( out, stride, offset ) {\n\tvar data;\n\tvar set;\n\tvar v;\n\tvar i;\n\n\tdata = out.data;\n\tset = out.accessors[ 1 ];\n\n\ti = offset;\n\tv = 1;\n\twhile ( i >= 0 && i < data.length ) {\n\t\tset( data, i, v );\n\t\ti += stride;\n\t\tv += 1;\n\t}\n\treturn data;\n}\n\n\n// MAIN //\n\n/**\n* Fills an array with linearly spaced numeric elements which increment by 1 starting from one.\n*\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* var arr = assign( out, -1, out.length-1 );\n* // returns [ 6, 5, 4, 3, 2, 1 ]\n*/\nfunction assign( out, stride, offset ) {\n\tvar obj = arraylike2object( out );\n\tif ( obj.accessorProtocol ) {\n\t\t// If provided a complex number array, reinterpret as a real typed array and only set the real components...\n\t\tif ( isComplex128Array( out ) ) {\n\t\t\treturn complex( out, reinterpret128( out, 0 ), stride, offset );\n\t\t}\n\t\tif ( isComplex64Array( out ) ) {\n\t\t\treturn complex( out, reinterpret64( out, 0 ), stride, offset );\n\t\t}\n\t\treturn accessors( obj, stride, offset );\n\t}\n\treturn indexed( out, stride, offset );\n}\n\n\n// EXPORTS //\n\nexport default assign;\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* Generate a linearly spaced numeric array whose elements increment by 1 starting from one.\n*\n* @module @stdlib/array-base-one-to\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var arr = oneTo( 6 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* import oneTo from '@stdlib/array-base-one-to';\n*\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n* var arr = oneTo.assign( out, 1, 0 );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* var bool = ( out === arr );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["oneTo","n","arr","i","push","complex","out","data","stride","offset","v","s","length","assign","obj","arraylike2object","accessorProtocol","isComplex128Array","reinterpret128","isComplex64Array","reinterpret64","set","accessors","indexed","setReadOnly","main"],"mappings":";;spBAgCA,SAASA,EAAOC,GACf,IAAIC,EACAC,EAGJ,GADAD,EAAM,GACDD,GAAK,EACT,OAAOC,EAER,IAAMC,EAAI,EAAGA,EAAIF,EAAE,EAAGE,IACrBD,EAAIE,KAAMD,GAEX,OAAOD,CACR,CCmDA,SAASG,EAASC,EAAKC,EAAMC,EAAQC,GACpC,IAAIC,EACAC,EACAR,EAKJ,IAHAQ,EAAa,EAATH,EACJL,EAAa,EAATM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BL,EAAMJ,GAAMO,EACZH,EAAMJ,EAAE,GAAM,EACdA,GAAKQ,EACLD,GAAK,EAEN,OAAOJ,CACR,CAqEA,SAASO,EAAQP,EAAKE,EAAQC,GAC7B,IAAIK,EAAMC,EAAkBT,GAC5B,OAAKQ,EAAIE,iBAEHC,EAAmBX,GAChBD,EAASC,EAAKY,EAAgBZ,EAAK,GAAKE,EAAQC,GAEnDU,EAAkBb,GACfD,EAASC,EAAKc,EAAed,EAAK,GAAKE,EAAQC,GAlDzD,SAAoBH,EAAKE,EAAQC,GAChC,IAAIF,EACAc,EACAX,EACAP,EAOJ,IALAI,EAAOD,EAAIC,KACXc,EAAMf,EAAIgB,UAAW,GAErBnB,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAII,EAAKK,QAC1BS,EAAKd,EAAMJ,EAAGO,GACdP,GAAKK,EACLE,GAAK,EAEN,OAAOH,CACR,CAmCSe,CAAWR,EAAKN,EAAQC,GAzIjC,SAAkBH,EAAKE,EAAQC,GAC9B,IAAIC,EACAP,EAIJ,IAFAA,EAAIM,EACJC,EAAI,EACIP,GAAK,GAAKA,EAAIG,EAAIM,QACzBN,EAAKH,GAAMO,EACXP,GAAKK,EACLE,GAAK,EAEN,OAAOJ,CACR,CA+HQiB,CAASjB,EAAKE,EAAQC,EAC9B,CC7IAe,EAAAC,EAAA,SAAAZ"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index f54de2e..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplex128Array = require( '@stdlib/array-base-assert-is-complex128array' ); -var isComplex64Array = require( '@stdlib/array-base-assert-is-complex64array' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); - - -// FUNCTIONS // - -/** -* Fills an indexed array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = indexed( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function indexed( out, stride, offset ) { - var v; - var i; - - i = offset; - v = 1; - while ( i >= 0 && i < out.length ) { - out[ i ] = v; - i += stride; - v += 1; - } - return out; -} - -/** -* Fills a complex number array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {(Complex128Array|Complex64Array)} out - output complex number array -* @param {(Float64Array|Float32Array)} data - output array data -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {(Complex128Array|Complex64Array)} output array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -* -* var out = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); -* // returns -* -* var data = reinterpret128( out, 0 ); -* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] -* -* var arr = complex( out, data, 1, 0 ); -* // returns -* -* var bool = ( arr === out ); -* // returns true -* -* data = reinterpret128( out, 0 ); -* returns [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -*/ -function complex( out, data, stride, offset ) { - var v; - var s; - var i; - - s = stride * 2; - i = offset * 2; - v = 1.0; - while ( i >= 0 && i < data.length ) { - data[ i ] = v; // real component - data[ i+1 ] = 0.0; // imaginary component - i += s; - v += 1.0; - } - return out; -} - -/** -* Fills an accessor array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @private -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); - -* var out = toAccessorArray( [ 0, 0, 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( out ), 1, 0 ); -* -* var bool = ( arr === out ); -* // returns true -* -* var v = out.get( 0 ); -* // returns 1 -* -* v = out.get( out.length-1 ); -* // returns 6 -*/ -function accessors( out, stride, offset ) { - var data; - var set; - var v; - var i; - - data = out.data; - set = out.accessors[ 1 ]; - - i = offset; - v = 1; - while ( i >= 0 && i < data.length ) { - set( data, i, v ); - i += stride; - v += 1; - } - return data; -} - - -// MAIN // - -/** -* Fills an array with linearly spaced numeric elements which increment by 1 starting from one. -* -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array index offset -* @returns {Collection} output array -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* -* var arr = assign( out, -1, out.length-1 ); -* // returns [ 6, 5, 4, 3, 2, 1 ] -*/ -function assign( out, stride, offset ) { - var obj = arraylike2object( out ); - if ( obj.accessorProtocol ) { - // If provided a complex number array, reinterpret as a real typed array and only set the real components... - if ( isComplex128Array( out ) ) { - return complex( out, reinterpret128( out, 0 ), stride, offset ); - } - if ( isComplex64Array( out ) ) { - return complex( out, reinterpret64( out, 0 ), stride, offset ); - } - return accessors( obj, stride, offset ); - } - return indexed( out, stride, offset ); -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 67f6b01..0000000 --- a/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @module @stdlib/array-base-one-to -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* @example -* var oneTo = require( '@stdlib/array-base-one-to' ); -* -* var out = [ 0, 0, 0, 0, 0, 0 ]; -* var arr = oneTo.assign( out, 1, 0 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -* -* var bool = ( out === arr ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index d1c25c9..0000000 --- a/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Generates a linearly spaced numeric array whose elements increment by 1 starting from one. -* -* @param {number} n - number of elements -* @returns {Array} linearly spaced numeric array -* -* @example -* var arr = oneTo( 6 ); -* // returns [ 1, 2, 3, 4, 5, 6 ] -*/ -function oneTo( n ) { - var arr; - var i; - - arr = []; - if ( n <= 0 ) { - return arr; - } - for ( i = 1; i < n+1; i++ ) { - arr.push( i ); - } - return arr; -} - - -// EXPORTS // - -module.exports = oneTo; diff --git a/package.json b/package.json index 27410fb..2703348 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Generate a linearly spaced numeric array whose elements increment by 1 starting from one.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,51 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex128array": "^0.2.2", - "@stdlib/array-base-assert-is-complex64array": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled-by": "^0.2.2", - "@stdlib/array-base-to-accessor-array": "^0.2.2", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-same-complex128array": "^0.2.2", - "@stdlib/assert-is-same-complex64array": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/blas-ext-base-gsort2hp": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-randu": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..3874c9f --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 11e9d98..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var oneTo = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (generic)', function test( t ) { - var expected; - var actual; - var out; - - out = [ 0, 0, 0, 0, 0 ]; - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ 0, 0, 0 ]; - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1 ]; - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - out = [ -1, -1, -1, -1, -1, -1 ]; - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (real typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Float64Array( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Float64Array( [ 1, 2, 3, 4, 5 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Float64Array( [ 3, 2, 1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Float64Array( [ -1, 1, -1, 2, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - out = new Float64Array( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = new Float64Array( [ 3, -1, 2, -1, 1, -1 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameFloat64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (complex typed array)', function test( t ) { - var expected; - var actual; - var out; - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex128Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex128Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex128Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex128Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex128Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = new Complex64Array( [ 1, 0, 2, 0, 3, 0, 4, 0, 5, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = new Complex64Array( [ 5, 0, 4, 0, 3, 0, 2, 0, 1, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - out = new Complex64Array( [ -1, -1, -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = new Complex64Array( [ -1, -1, 1, 0, -1, -1, 2, 0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills an array with linearly spaced numbers (accessor)', function test( t ) { - var expected; - var actual; - var out; - - out = toAccessorArray( [ 0, 0, 0, 0, 0 ] ); - actual = oneTo( out, 1, 0 ); - expected = [ 1, 2, 3, 4, 5 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ 0, 0, 0 ] ); - actual = oneTo( out, -1, out.length-1 ); - expected = [ 3, 2, 1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, 2, 1 ); - expected = [ -1, 1, -1, 2, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - out = toAccessorArray( [ -1, -1, -1, -1, -1, -1 ] ); - actual = oneTo( out, -2, out.length-2 ); - expected = [ 3, -1, 2, -1, 1, -1 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns an empty array if provided an empty array', function test( t ) { - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.deepEqual( oneTo( [], 1, 0 ), [], 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 39949a0..0000000 --- a/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( oneTo, 'assign' ), true, 'has property' ); - t.strictEqual( typeof oneTo.assign, 'function', 'has method' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 9911394..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var oneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof oneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a linearly spaced array', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5 ); - expected = [ 1, 2, 3, 4, 5 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a linearly spaced array (fractional argument)', function test( t ) { - var expected; - var actual; - - actual = oneTo( 10.5 ); - expected = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - actual = oneTo( 5.0000001 ); - expected = [ 1, 2, 3, 4, 5, 6 ]; - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty array if provided a value which is less than or equal to zero', function test( t ) { - t.deepEqual( oneTo( -1 ), [], 'returns expected value' ); - t.deepEqual( oneTo( 0 ), [], 'returns expected value' ); - t.end(); -});