diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +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 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# 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 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index d9d9506..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-08-19T03:12:00.689Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index de7f5e6..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/dstructs/struct) 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 8a284d6..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/dstructs/struct) 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 1a6bc38..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: '20 8 * * 2' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -304,7 +295,7 @@ console.log( 'Description: %s', desc ); ## 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 b7ae520..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,78 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 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 isFunction = require( '@stdlib/assert-is-function' ); -var pkg = require( './../package.json' ).name; -var struct = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var v; - var i; - - values = [ - [ - { - 'name': 'foo', - 'type': 'float64' - } - ], - [ - { - 'name': 'bar', - 'type': 'float32' - } - ], - [ - { - 'name': 'beep', - 'type': 'int32' - } - ], - [ - { - 'name': 'boop', - 'type': 'uint32' - } - ] - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = struct( values[ i%values.length ] ); - if ( typeof v !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( !isFunction( v ) ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -// FIXME: add benchmarks diff --git a/branches.md b/branches.md deleted file mode 100644 index 724c562..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/dstructs/struct" -%% click B href "https://github.com/stdlib-js/dstructs-struct/tree/main" -%% click C href "https://github.com/stdlib-js/dstructs-struct/tree/production" -%% click D href "https://github.com/stdlib-js/dstructs-struct/tree/esm" -%% click E href "https://github.com/stdlib-js/dstructs-struct/tree/deno" -%% click F href "https://github.com/stdlib-js/dstructs-struct/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/dstructs/struct -[production-url]: https://github.com/stdlib-js/dstructs-struct/tree/production -[deno-url]: https://github.com/stdlib-js/dstructs-struct/tree/deno -[deno-readme]: https://github.com/stdlib-js/dstructs-struct/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/dstructs-struct/tree/umd -[umd-readme]: https://github.com/stdlib-js/dstructs-struct/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/dstructs-struct/tree/esm -[esm-readme]: https://github.com/stdlib-js/dstructs-struct/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 764d656..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var u=function(e,i){return function(){try{return i||e((i={exports:{}}).exports,i),i.exports}catch(r){throw i=0,r}}};var m=u(function(ou,ve){"use strict";var Et="__@@##$$@@__struct_buffer__@@$$##@@__";ve.exports=Et});var ce=u(function(fu,le){"use strict";var wt="Struct";le.exports=wt});var Y=u(function(vu,ge){"use strict";var Tt={int8:{get:"getInt8",set:"setInt8"},int16:{get:"getInt16",set:"setInt16"},int32:{get:"getInt32",set:"setInt32"},int64:{get:"getBigInt64",set:"setBigInt64"},uint8:{get:"getUint8",set:"setUint8"},uint16:{get:"getUint16",set:"setUint16"},uint32:{get:"getUint32",set:"setUint32"},uint64:{get:"getBigUint64",set:"setBigUint64"},float16:{get:"getFloat16",set:"setFloat16"},float32:{get:"getFloat32",set:"setFloat32"},float64:{get:"getFloat64",set:"setFloat64"},complex32:{get:"getFloat16",set:"setFloat16"},complex64:{get:"getFloat32",set:"setFloat32"},complex128:{get:"getFloat64",set:"setFloat64"},bool:{get:"getUint8",set:"setUint8"}};ge.exports=Tt});var me=u(function(lu,pe){"use strict";var xt=require("@stdlib/assert-is-little-endian"),Ot=m();function bt(e,i){return r;function r(){var t=this[Ot];return t[i](e.byteOffset,xt)}}pe.exports=bt});var qe=u(function(cu,ye){"use strict";var It=require("@stdlib/assert-is-little-endian"),St=require("@stdlib/boolean-ctor"),At=m();function Ft(e,i){return r;function r(){var t=this[At];return St(t[i](e.byteOffset,It))}}ye.exports=Ft});var Ee=u(function(gu,de){"use strict";var he=require("@stdlib/assert-is-little-endian"),Nt=require("@stdlib/complex-cmplx"),Vt=m(),Lt={complex128:"float64",complex64:"float32",complex32:"float16"};function Pt(e,i){return r;function r(){var t=this[Vt],s=t[i](e.byteOffset,he),n=t[i](e.byteOffset+e.byteLength/2,he);return Nt(s,n,Lt[e.type])}}de.exports=Pt});var Te=u(function(pu,we){"use strict";var Rt=require("@stdlib/assert-is-little-endian"),_t=m();function Bt(e,i){return r;function r(){var t=this[_t];return t[i](e.byteOffset,Rt)}}we.exports=Bt});var Oe=u(function(mu,xe){"use strict";var Dt=m();function Ut(e){return i;function i(){var r=this[Dt];return new e.type(r.buffer,r.byteOffset+e.byteOffset,e.byteLength)}}xe.exports=Ut});var Ie=u(function(yu,be){"use strict";var Ct=require("@stdlib/array-typed"),Mt=m();function kt(e){return i;function i(){var r=this[Mt];return Ct(r.buffer,r.byteOffset+e.byteOffset,e.length,e.type)}}be.exports=kt});var Ae=u(function(qu,Se){"use strict";var Jt=m();function zt(e){return i;function i(){var r,t,s,n;for(t=this[Jt],r=t.byteOffset+e.byteOffset,s=[],n=0;n0?null:new TypeError(ua("invalid argument. `%s` field must be a non-empty string. Value: `%s`.",i,e))}yr.exports=oa});var dr=u(function(ku,hr){"use strict";var fa=require("@stdlib/assert-is-string").isPrimitive,va=require("@stdlib/string-format");function la(e,i){return fa(e)?null:new TypeError(va("invalid argument. `%s` field must be a string. Value: `%s`.",i,e))}hr.exports=la});var wr=u(function(Ju,Er){"use strict";var ca=require("@stdlib/assert-is-positive-integer").isPrimitive,ga=require("@stdlib/string-format");function pa(e,i){return ca(e)?null:new TypeError(ga("invalid argument. `%s` field must be a positive integer. Value: `%s`.",i,e))}Er.exports=pa});var xr=u(function(zu,Tr){"use strict";var ma=require("@stdlib/assert-is-boolean").isPrimitive,ya=require("@stdlib/string-format");function qa(e,i){return ma(e)?null:new TypeError(ya("invalid argument. `%s` field must be a boolean. Value: `%s`.",i,e))}Tr.exports=qa});var br=u(function(Gu,Or){"use strict";var ha=["int8","int16","int32","int64","uint8","uint16","uint32","uint64","float32","float64","complex64","complex128","bool"];Or.exports=ha});var Ar=u(function(Wu,Sr){"use strict";var da=require("@stdlib/assert-is-struct-constructor-like"),Ea=require("@stdlib/array-base-assert-contains"),wa=require("@stdlib/array-base-join"),Ta=require("@stdlib/string-format"),Ir=br();function xa(e){return Ea(Ir,e)||da(e)?null:new TypeError(Ta('invalid argument. `%s` field must be either a struct type or one of the following: "%s". Value: `%s`.',"type",wa(Ir,", "),e))}Sr.exports=xa});var Nr=u(function(Hu,Fr){"use strict";var Oa=require("@stdlib/array-base-assert-contains"),ba=require("@stdlib/array-base-join"),Ia=require("@stdlib/string-format");function Sa(e){return i;function i(r,t){return Oa(e,r)?null:new TypeError(Ia('invalid argument. `%s` field must be one of the following: "%s". Value: `%s`.',t,ba(e,", "),r))}}Fr.exports=Sa});var Lr=u(function(Yu,Vr){"use strict";function Aa(){return{isStructType:!1,description:"",byteLength:0,byteOffset:0,alignment:0,padding:0,enumerable:!0,writable:!0,default:void 0,castingMode:"none"}}Vr.exports=Aa});var Rr=u(function($u,Pr){"use strict";var Fa=require("@stdlib/ndarray-base-bytes-per-element");function Na(e){var i;return e.isStructType?i=e.type.byteLength:i=Fa(e.type),e.length&&(i*=e.length),i}Pr.exports=Na});var Br=u(function(Xu,_r){"use strict";var Va=["none","safe","mostly-safe","same-kind","unsafe"];_r.exports=Va});var Ur=u(function(Ku,Dr){"use strict";var La={int8:1,int16:2,int32:4,int64:8,uint8:1,uint16:2,uint32:4,uint64:8,float16:2,float32:4,float64:8,complex32:2,complex64:4,complex128:8,bool:1};Dr.exports=La});var te=u(function(Qu,kr){"use strict";var Pa=require("@stdlib/assert-is-struct-constructor-like"),Ra=require("@stdlib/assert-has-property"),_a=require("@stdlib/array-base-join"),Ba=require("@stdlib/utils-constant-function"),Da=require("@stdlib/string-format"),Ua=mr(),Ca=qr(),Ma=dr(),ka=wr(),Cr=xr(),Ja=Ar(),za=Nr(),Ga=Lr(),Wa=Rr(),Ha=Br(),Ya=Ur(),Mr=["name","type"],$a={name:Ca,type:Ja,description:Ma,length:ka,enumerable:Cr,writable:Cr,default:Ba(null),castingMode:za(Ha)};function Xa(e,i){var r,t,s,n,a;for(r=Ga(),a=0;ai&&(i=r);return i}Jr.exports=Ka});var Wr=u(function(ju,Gr){"use strict";var Qa=require("@stdlib/assert-is-object"),zr=require("@stdlib/assert-has-property"),ne=require("@stdlib/string-format"),Za=L(),ja=re(),es=te(),rs=ie();function ts(e){var i,r,t,s,n,a,o;if(i=e.fields,i.length===0)return null;for(t=[],o=0;o0&&(n=e[o-1],n.padding=t,ae(a)&&et(n.fields,t)),a.byteOffset=s,ae(a))for(p=0;pb&&(b=A);for(s="%"+b+"s",n="// %s",p="%s: %s %s",g=0,f=[],q=0;q0&&c.byteOffset===i[q-1].byteOffset)){for(q1?a=" (byte %u)":a="",l){for(o=" => union: %s",v=[],P=q+1;P":F=E.type,v.push(y("%s<%s>[%u]",E.name,F,T%E.alignment)),P+=1;o=y(o,v.join(", "))}else o="";v=y(a+o,T%c.alignment),c.length?w=y(n,y("%s[%u]%s",c.type,Es(T/c.alignment),v)):w=y(n,y("%s%s",c.type,v)),f.push(y(p,x,d,w)),g+=1}for(T=0;T0&&n.byteOffset===e[a-1].byteOffset)){if(n.isStructType){i.push(Ts(n.type.layout,t,Os(n.byteOffset)));continue}i.push(se("|<%s>[%u,%u]",n.type,n.byteOffset,n.byteLength))}return r=se("%s|",i.join("")),r[r.length-2]==="|"&&(r=r.substring(0,r.length-1)),r}ft.exports=bs});var gt=u(function(oo,ct){"use strict";var Is=require("@stdlib/assert-is-plain-object"),Ss=require("@stdlib/assert-has-own-property"),As=require("@stdlib/array-base-assert-contains").factory,Fs=require("@stdlib/array-base-join"),vt=require("@stdlib/string-format"),Ns=ot(),Vs=ue(),lt=["none","linear","layout"],Ls=As(lt);function Ps(e,i,r){var t;if(!Is(r))throw new TypeError(vt("invalid argument. Options argument must be an object. Value: `%s`.",r));if(t={format:"none"},Ss(r,"format")&&(t.format=r.format,!Ls(t.format)))throw new TypeError(vt('invalid option. `%s` option must be one of the following: "%s". Option: `%s`.',"format",Fs(lt,", "),r.format));return t.format==="linear"?Ns(e,i):t.format==="layout"?Vs(i):""}ct.exports=Ps});var mt=u(function(fo,pt){"use strict";var Rs=require("@stdlib/assert-is-collection"),_s=require("@stdlib/assert-is-complex-like"),Bs=require("@stdlib/assert-is-function"),Ds=require("@stdlib/array-to-json"),Us=R();function Cs(e,i){var r,t,s,n;for(r={},n=0;n0){if(!zs(f))throw new TypeError(N("invalid argument. First argument must be an object. Value: `%s`.",f));b=f}if(h(this,oe,O),b!==void 0){for(x=Hs(void 0,a.length),w={},c=0;c0?l=arguments[0]:l={},tu(v,a,l)}),h(v.prototype,"toJSON",function(){if(!(this instanceof v))throw new Error("invalid invocation. `this` is not a struct instance.");return iu(this,a)}),v}ht.exports=au});var su=dt();module.exports=su; -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index ffa4c34..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/private_buffer.js", "../lib/ctor_name.js", "../lib/data_view_methods.js", "../lib/get_number.js", "../lib/get_boolean.js", "../lib/get_complex.js", "../lib/get_bigint.js", "../lib/get_struct.js", "../lib/get_typedarray.js", "../lib/get_struct_array.js", "../lib/getter.js", "../lib/boolean2number.js", "../lib/bigint2number.js", "../lib/defaults.json", "../lib/set_number.js", "../lib/set_complex.js", "../lib/number2boolean.js", "../lib/complex2boolean.js", "../lib/bigint2boolean.js", "../lib/set_boolean.js", "../lib/boolean2bigint.js", "../lib/set_bigint.js", "../lib/is_struct_instance.js", "../lib/set_struct.js", "../lib/complex2number.js", "../lib/set_typedarray.js", "../lib/set_struct_array.js", "../lib/setter.js", "../lib/create_prototype_accessors.js", "../lib/field_properties.js", "../lib/is_union_type.js", "../lib/has_properties.js", "../lib/is_valid_nonempty_string.js", "../lib/is_valid_string.js", "../lib/is_valid_positive_integer.js", "../lib/is_valid_boolean.js", "../lib/dtypes.js", "../lib/is_valid_type.js", "../lib/is_valid_one_of.js", "../lib/init_field_object.js", "../lib/byte_length.js", "../lib/casting_modes.js", "../lib/alignments.js", "../lib/normalize_field.js", "../lib/resolve_alignment.js", "../lib/normalize_union.js", "../lib/normalize_field_list.js", "../lib/field_names.js", "../lib/field_index.js", "../lib/byte_offsets.js", "../lib/partitions.js", "../lib/flatten_fields.js", "../lib/format_linear.js", "../lib/format_layout.js", "../lib/to_string.js", "../lib/to_json.js", "../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n// Define a property name which is unlikely to be used in end user code:\nvar PRIVATE_BUFFER = '__@@##$$@@__struct_buffer__@@$$##@@__';\n\n\n// EXPORTS //\n\nmodule.exports = PRIVATE_BUFFER;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar CTOR_NAME = 'Struct';\n\n\n// EXPORTS //\n\nmodule.exports = CTOR_NAME;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar DATA_VIEW_METHODS = {\n\t'int8': {\n\t\t'get': 'getInt8',\n\t\t'set': 'setInt8'\n\t},\n\t'int16': {\n\t\t'get': 'getInt16',\n\t\t'set': 'setInt16'\n\t},\n\t'int32': {\n\t\t'get': 'getInt32',\n\t\t'set': 'setInt32'\n\t},\n\t'int64': {\n\t\t'get': 'getBigInt64',\n\t\t'set': 'setBigInt64'\n\t},\n\t'uint8': {\n\t\t'get': 'getUint8',\n\t\t'set': 'setUint8'\n\t},\n\t'uint16': {\n\t\t'get': 'getUint16',\n\t\t'set': 'setUint16'\n\t},\n\t'uint32': {\n\t\t'get': 'getUint32',\n\t\t'set': 'setUint32'\n\t},\n\t'uint64': {\n\t\t'get': 'getBigUint64',\n\t\t'set': 'setBigUint64'\n\t},\n\t'float16': {\n\t\t'get': 'getFloat16',\n\t\t'set': 'setFloat16'\n\t},\n\t'float32': {\n\t\t'get': 'getFloat32',\n\t\t'set': 'setFloat32'\n\t},\n\t'float64': {\n\t\t'get': 'getFloat64',\n\t\t'set': 'setFloat64'\n\t},\n\t'complex32': {\n\t\t'get': 'getFloat16',\n\t\t'set': 'setFloat16'\n\t},\n\t'complex64': {\n\t\t'get': 'getFloat32',\n\t\t'set': 'setFloat32'\n\t},\n\t'complex128': {\n\t\t'get': 'getFloat64',\n\t\t'set': 'setFloat64'\n\t},\n\t'bool': {\n\t\t'get': 'getUint8',\n\t\t'set': 'setUint8'\n\t}\n};\n\n\n// EXPORTS //\n\nmodule.exports = DATA_VIEW_METHODS;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for resolving field data\n*/\nfunction getNumber( obj, method ) {\n\treturn getter;\n\n\t/**\n\t* Reads a number value from an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {number} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getNumber;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar Boolean = require( '@stdlib/boolean-ctor' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for resolving field data\n*/\nfunction getBoolean( obj, method ) {\n\treturn getter;\n\n\t/**\n\t* Reads a boolean value from an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {boolean} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn Boolean( view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getBoolean;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar complex = require( '@stdlib/complex-cmplx' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// VARIABLES //\n\nvar CMPLX_TO_REAL = {\n\t'complex128': 'float64',\n\t'complex64': 'float32',\n\t'complex32': 'float16'\n};\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for resolving field data\n*/\nfunction getComplex( obj, method ) {\n\treturn getter;\n\n\t/**\n\t* Reads a complex number from an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {Complex} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\tvar re = view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN );\n\t\tvar im = view[ method ]( obj.byteOffset+(obj.byteLength/2), IS_LITTLE_ENDIAN );\n\t\treturn complex( re, im, CMPLX_TO_REAL[ obj.type ] );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getComplex;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for resolving field data\n*/\nfunction getBigInt( obj, method ) {\n\treturn getter;\n\n\t/**\n\t* Reads a BigInt value from an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {BigInt} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getBigInt;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for resolving field data\n*/\nfunction getStruct( obj ) {\n\treturn getter;\n\n\t/**\n\t* Returns a `struct` view of an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {Object} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn new obj.type( view.buffer, view.byteOffset+obj.byteOffset, obj.byteLength ); // eslint-disable-line max-len\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getStruct;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar typedarray = require( '@stdlib/array-typed' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for resolving field data\n*/\nfunction getTypedArray( obj ) {\n\treturn getter;\n\n\t/**\n\t* Returns a typed array view of an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {TypedArray} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn typedarray( view.buffer, view.byteOffset+obj.byteOffset, obj.length, obj.type ); // eslint-disable-line max-len\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getTypedArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for resolving field data\n*/\nfunction getStructArray( obj ) {\n\treturn getter;\n\n\t/**\n\t* Returns a list of `struct` views of an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {Array} result\n\t*/\n\tfunction getter() {\n\t\tvar offset;\n\t\tvar view;\n\t\tvar out;\n\t\tvar i;\n\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\toffset = view.byteOffset + obj.byteOffset;\n\t\tout = [];\n\t\tfor ( i = 0; i < obj.length; i++ ) {\n\t\t\tout.push( new obj.type( view.buffer, offset, obj.byteLength ) );\n\t\t\toffset += obj.byteOffset;\n\t\t}\n\t\treturn out;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getStructArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 format = require( '@stdlib/string-format' );\nvar DATA_VIEW_METHODS = require( './data_view_methods.js' );\nvar getNumber = require( './get_number.js' );\nvar getBoolean = require( './get_boolean.js' );\nvar getComplex = require( './get_complex.js' );\nvar getBigInt = require( './get_bigint.js' );\nvar getStruct = require( './get_struct.js' );\nvar getTypedArray = require( './get_typedarray.js' );\nvar getStructArray = require( './get_struct_array.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @throws {Error} unexpected error\n* @returns {Function} function for resolving field data\n*/\nfunction getter( obj ) {\n\tif ( obj.length ) {\n\t\tif ( obj.isStructType ) {\n\t\t\treturn getStructArray( obj );\n\t\t}\n\t\treturn getTypedArray( obj );\n\t}\n\tswitch ( obj.type ) {\n\tcase 'float64':\n\tcase 'float32':\n\tcase 'float16':\n\tcase 'int8':\n\tcase 'int16':\n\tcase 'int32':\n\tcase 'uint8':\n\tcase 'uint16':\n\tcase 'uint32':\n\t\treturn getNumber( obj, DATA_VIEW_METHODS[ obj.type ].get );\n\n\tcase 'int64':\n\tcase 'uint64':\n\t\treturn getBigInt( obj, DATA_VIEW_METHODS[ obj.type ].get );\n\n\tcase 'bool':\n\t\treturn getBoolean( obj, DATA_VIEW_METHODS[ obj.type ].get );\n\n\tcase 'complex128':\n\tcase 'complex64':\n\tcase 'complex32':\n\t\treturn getComplex( obj, DATA_VIEW_METHODS[ obj.type ].get );\n\n\tdefault:\n\t\tif ( obj.isStructType ) {\n\t\t\treturn getStruct( obj );\n\t\t}\n\t\t// Ensure that we fail loudly if we have failed to add support for newly added data types:\n\t\tthrow new Error( format( 'unexpected error. Unrecognized data type. Value: `%s`.', obj.type ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = getter;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Converts a boolean to a number.\n*\n* @private\n* @param {boolean} value - input value\n* @returns {number} result\n*/\nfunction boolean2number( value ) {\n\treturn ( value ) ? 1 : 0;\n}\n\n\n// EXPORTS //\n\nmodule.exports = boolean2number;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n/**\n* Converts a BigInt to a number.\n*\n* @private\n* @param {BigInt} value - input value\n* @returns {number} result\n*/\nfunction bigint2number( value ) {\n\treturn Number( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = bigint2number;\n", "{\n \"dtypes\": {\n \"real\": \"float64\",\n \"complex\": \"complex128\"\n }\n}\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar isRealFloatingPointDataType = require( '@stdlib/array-base-assert-is-real-floating-point-data-type' ); // eslint-disable-line id-length\nvar isSignedIntegerDataType = require( '@stdlib/array-base-assert-is-signed-integer-data-type' );\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive;\nvar isComplexLike = require( '@stdlib/assert-is-complex-like' );\nvar isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' );\nvar minDataType = require( '@stdlib/array-min-dtype' );\nvar minSignedIntegerDataType = require( '@stdlib/array-base-min-signed-integer-dtype' );\nvar complexDType = require( '@stdlib/complex-dtype' );\nvar format = require( '@stdlib/string-format' );\nvar boolean2number = require( './boolean2number.js' );\nvar bigint2number = require( './bigint2number.js' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setNumber( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a number value to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar v;\n\t\tif ( isNumber( value ) ) {\n\t\t\tif ( isRealFloatingPointDataType( obj.type ) ) {\n\t\t\t\tdt = obj.type;\n\t\t\t} else if ( !isInteger( value ) ) {\n\t\t\t\tdt = defaults.dtypes.real;\n\t\t\t} else if ( isSignedIntegerDataType( obj.type ) ) {\n\t\t\t\tdt = minSignedIntegerDataType( value );\n\t\t\t} else {\n\t\t\t\tdt = minDataType( value );\n\t\t\t}\n\t\t\tv = value;\n\t\t} else if ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || ( ( obj.type === 'float32' ) ? 'complex64' : 'complex128' );\n\t\t\tv = value.re; // discard imaginary component\n\t\t} else if ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tv = boolean2number( value );\n\t\t} else if ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here\n\t\t\tv = bigint2number( value );\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tv = value;\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setNumber;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive;\nvar isComplexLike = require( '@stdlib/assert-is-complex-like' );\nvar isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' );\nvar complexDType = require( '@stdlib/complex-dtype' );\nvar format = require( '@stdlib/string-format' );\nvar boolean2number = require( './boolean2number.js' );\nvar bigint2number = require( './bigint2number.js' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setComplex( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a complex number to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar re;\n\t\tvar im;\n\t\tif ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || obj.type;\n\t\t\tre = value.re;\n\t\t\tim = value.im;\n\t\t} else if ( isNumber( value ) ) {\n\t\t\tdt = ( obj.type === 'complex64' ) ? 'float32' : 'float64';\n\t\t\tre = value;\n\t\t\tim = 0.0;\n\t\t} else if ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here\n\t\t\tre = bigint2number( value );\n\t\t\tim = 0.0;\n\t\t} else if ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tre = boolean2number( value );\n\t\t\tim = 0.0;\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tre = value;\n\t\t\tim = 0.0;\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, re, IS_LITTLE_ENDIAN );\n\t\tview[ method ]( obj.byteOffset+(obj.byteLength/2), im, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setComplex;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Boolean = require( '@stdlib/boolean-ctor' );\n\n\n// MAIN //\n\n/**\n* Converts a number to a boolean.\n*\n* @private\n* @param {number} value - input value\n* @returns {boolean} result\n*/\nfunction number2boolean( value ) {\n\treturn Boolean( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = number2boolean;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Boolean = require( '@stdlib/boolean-ctor' );\n\n\n// MAIN //\n\n/**\n* Converts a complex number to a boolean.\n*\n* @private\n* @param {ComplexLike} value - input value\n* @returns {boolean} result\n*/\nfunction complex2boolean( value ) {\n\treturn Boolean( value.re || value.im );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complex2boolean;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Boolean = require( '@stdlib/boolean-ctor' );\n\n\n// MAIN //\n\n/**\n* Converts a BigInt to a boolean.\n*\n* @private\n* @param {BigInt} value - input value\n* @returns {boolean} result\n*/\nfunction bigint2boolean( value ) {\n\treturn Boolean( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = bigint2boolean;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive;\nvar isComplexLike = require( '@stdlib/assert-is-complex-like' );\nvar isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' );\nvar complexDType = require( '@stdlib/complex-dtype' );\nvar Boolean = require( '@stdlib/boolean-ctor' );\nvar format = require( '@stdlib/string-format' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\nvar boolean2number = require( './boolean2number.js' );\nvar number2boolean = require( './number2boolean.js' );\nvar complex2boolean = require( './complex2boolean.js' );\nvar bigint2boolean = require( './bigint2boolean.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setBoolean( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a boolean value to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar v;\n\t\tif ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tv = boolean2number( value );\n\t\t} else if ( isNumber( value ) ) {\n\t\t\tdt = defaults.dtypes.real;\n\t\t\tv = boolean2number( number2boolean( value ) );\n\t\t} else if ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here\n\t\t\tv = boolean2number( bigint2boolean( value ) );\n\t\t} else if ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || defaults.dtypes.complex;\n\t\t\tv = boolean2number( complex2boolean( value ) );\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tv = Boolean( value );\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setBoolean;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 BigInt = require( '@stdlib/bigint-ctor' );\n\n\n// MAIN //\n\n/**\n* Converts a boolean to a BigInt.\n*\n* @private\n* @param {boolean} value - input value\n* @returns {number} result\n*/\nfunction boolean2bigint( value ) {\n\treturn BigInt( ( value ) ? 1 : 0 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = boolean2bigint;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' );\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive;\nvar isComplexLike = require( '@stdlib/assert-is-complex-like' );\nvar isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' );\nvar minDataType = require( '@stdlib/array-min-dtype' );\nvar complexDType = require( '@stdlib/complex-dtype' );\nvar BigInt = require( '@stdlib/bigint-ctor' );\nvar Number = require( '@stdlib/number-ctor' );\nvar floor = require( '@stdlib/math-base-special-floor' );\nvar format = require( '@stdlib/string-format' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\nvar boolean2bigint = require( './boolean2bigint.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setBigInt( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a number value to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar v;\n\t\tif ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // FIXME: support both int64 and uint64\n\t\t\tv = value;\n\t\t} else if ( isNumber( value ) ) {\n\t\t\tif ( isInteger( value ) ) {\n\t\t\t\tdt = minDataType( value );\n\t\t\t\tv = BigInt( value );\n\t\t\t} else {\n\t\t\t\tdt = defaults.dtypes.real;\n\t\t\t\tv = BigInt( floor( value ) );\n\t\t\t}\n\t\t} else if ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tv = boolean2bigint( value );\n\t\t} else if ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || defaults.dtypes.complex;\n\t\t\tv = BigInt( floor( value.re ) ); // discard imaginary component\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tv = BigInt( floor( Number( v ) ) );\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setBigInt;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isDataView = require( '@stdlib/assert-is-dataview' );\nvar isObject = require( '@stdlib/assert-is-object' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `struct` instance.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `struct` instance\n*/\nfunction isStructInstance( value ) {\n\t// NOTE: the following is a relatively weak test, but we cannot use `instanceof` checks, etc, due to the factory nature of the implementation. Regardless, here, we are just trying to sniff out a `struct` type. If calling as a constructor later fails, we punt the responsibility off to the user to handle what should be an edge case. If, in the future, this check proves insufficient, we can add further \"brand\" checks...\n\treturn (\n\t\tisObject( value ) &&\n\t\tisDataView( value[ PRIVATE_BUFFER ] )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isStructInstance;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar gcopy = require( '@stdlib/blas-base-gcopy' );\nvar format = require( '@stdlib/string-format' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\nvar isStructInstance = require( './is_struct_instance.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for writing field data\n*/\nfunction setStruct( obj ) {\n\treturn setter;\n\n\t/**\n\t* Writes `struct` data to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {Object} value - value to set\n\t* @throws {TypeError} must be a `struct` instance\n\t* @throws {RangeError} must be a `struct` instance having the same byte length\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dest;\n\t\tvar src;\n\t\tvar buf;\n\t\tvar nb;\n\t\tif ( !isStructInstance( value ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a `struct` instance. Value: `%s`.', obj.name, value ) );\n\t\t}\n\t\tif ( obj.casting === 'none' && !( value instanceof obj.type ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Value: `%s`.', obj.name, value ) );\n\t\t}\n\t\tnb = obj.byteLength;\n\n\t\tbuf = this.constructor.viewOf( value );\n\t\tif ( buf.byteLength !== nb ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be a `struct` instance having the same byte length.', obj.name ) );\n\t\t}\n\t\tsrc = new Uint8Array( buf.buffer, buf.byteOffset, nb );\n\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tdest = new Uint8Array( view.buffer, view.byteOffset+obj.byteOffset, nb ); // eslint-disable-line max-len\n\n\t\tgcopy( obj.length, src, 1, dest, 1 );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setStruct;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Converts a complex number to a number.\n*\n* @private\n* @param {ComplexLike} value - input value\n* @returns {number} result\n*/\nfunction complex2number( value ) {\n\treturn value.re;\n}\n\n\n// EXPORTS //\n\nmodule.exports = complex2number;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' );\nvar isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' );\nvar isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' );\nvar isRealDataType = require( '@stdlib/array-base-assert-is-real-data-type' );\nvar typedarray = require( '@stdlib/array-typed' );\nvar dtype = require( '@stdlib/array-dtype' );\nvar reinterpretComplex = require( '@stdlib/strided-base-reinterpret-complex' );\nvar reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' );\nvar gcopy = require( '@stdlib/blas-base-gcopy' );\nvar gfill = require( '@stdlib/blas-ext-base-gfill' );\nvar map = require( '@stdlib/array-base-map' );\nvar format = require( '@stdlib/string-format' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\nvar isStructInstance = require( './is_struct_instance.js' );\nvar number2boolean = require( './number2boolean.js' );\nvar complex2boolean = require( './complex2boolean.js' );\nvar complex2number = require( './complex2number.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for writing field data\n*/\nfunction setTypedArray( obj ) {\n\treturn setter;\n\n\t/**\n\t* Writes a list of values to a typed array view of an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {Collection} value - value to set\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {RangeError} must provide an array-like object having an expected length\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar buf;\n\t\tvar dt;\n\t\tif ( !isCollection( value ) || isStructInstance( value ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', obj.name, value ) );\n\t\t}\n\t\tif ( value.length !== obj.length ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be an array-like object having length %u.', obj.name, obj.length ) );\n\t\t}\n\t\tdt = dtype( value );\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tbuf = this[ PRIVATE_BUFFER ];\n\t\tview = typedarray( buf.buffer, buf.byteOffset+obj.byteOffset, obj.length, obj.type );\n\t\tif ( dt === obj.type ) {\n\t\t\t// Case: complex => complex\n\t\t\tif ( isComplexDataType( dt ) ) {\n\t\t\t\tgcopy( obj.length*2, reinterpretComplex( value, 0 ), 1, reinterpretComplex( view, 0 ), 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: boolean => boolean\n\t\t\tif ( isBooleanDataType( dt ) ) {\n\t\t\t\tgcopy( obj.length, reinterpretBoolean( value, 0 ), 1, reinterpretBoolean( view, 0 ), 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: real => real\n\t\t\tgcopy( obj.length, value, 1, view, 1 );\n\t\t\treturn;\n\t\t}\n\t\t// Case: real => ???\n\t\tif ( isRealDataType( dt ) ) {\n\t\t\t// Case: real => real\n\t\t\tif ( isRealDataType( obj.type ) ) {\n\t\t\t\tgcopy( obj.length, value, 1, view, 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: real => complex\n\t\t\tif ( isComplexDataType( obj.type ) ) {\n\t\t\t\tview = reinterpretComplex( view, 0 );\n\n\t\t\t\t// TODO: consider refactoring to avoid two-passes; may require creating a separate strided utility explicitly aimed at casting real-valued arrays to complex arrays\n\t\t\t\tgcopy( obj.length, view, 2, value, 1 ); // assign to only real-components\n\t\t\t\tgfill.ndarray( obj.length, 0.0, view, 2, 1 ); // fill imaginary components with zeros\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: real => boolean\n\t\t\tmap.assign( value, view, 1, 0, number2boolean );\n\t\t\treturn;\n\t\t}\n\t\t// Case: complex => ???\n\t\tif ( isComplexDataType( dt ) ) {\n\t\t\t// Case: complex => real\n\t\t\tif ( isRealDataType( obj.type ) ) {\n\t\t\t\tmap.assign( value, view, 1, 0, complex2number ); // discard imaginary components\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: complex => complex\n\t\t\tif ( isComplexDataType( obj.type ) ) {\n\t\t\t\tgcopy( obj.length*2, reinterpretComplex( value, 0 ), 1, reinterpretComplex( view, 0 ), 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: complex => boolean\n\t\t\tmap.assign( value, view, 1, 0, complex2boolean );\n\t\t\treturn;\n\t\t}\n\t\t// Case: boolean => ???\n\n\t\t// Case: boolean => real\n\t\tif ( isRealDataType( obj.type ) ) {\n\t\t\tgcopy( obj.length, reinterpretBoolean( value, 0 ), 1, view, 1 );\n\t\t\treturn;\n\t\t}\n\t\t// Case: boolean => complex\n\t\tview = reinterpretComplex( view, 0 );\n\n\t\t// TODO: consider refactoring to avoid two-passes; may require creating a separate strided utility explicitly aimed at casting real-valued arrays to complex arrays\n\t\tgcopy( obj.length, view, 2, reinterpretBoolean( value, 0 ), 1 ); // assign to only real-components\n\t\tgfill.ndarray( obj.length, 0.0, view, 2, 1 ); // fill imaginary components with zeros\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setTypedArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar gcopy = require( '@stdlib/blas-base-gcopy' );\nvar format = require( '@stdlib/string-format' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for writing field data\n*/\nfunction setStructArray( obj ) {\n\treturn setter;\n\n\t/**\n\t* Writes a list of `struct` instances to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {Collection} values - list of `struct` instances\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {RangeError} must provide an array-like object having an expected length\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( values ) {\n\t\tvar offset;\n\t\tvar views;\n\t\tvar view;\n\t\tvar dest;\n\t\tvar src;\n\t\tvar buf;\n\t\tvar nb;\n\t\tvar i;\n\n\t\tif ( !isCollection( values ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', obj.name, values ) );\n\t\t}\n\t\tif ( values.length !== obj.length ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be an array-like object having length %u.', obj.name, obj.length ) );\n\t\t}\n\t\tif ( obj.casting === 'none' ) {\n\t\t\tfor ( i = 0; i < values.length; i++ ) {\n\t\t\t\tif ( !( values[ i ] instanceof obj.type ) ) { // note: this check will fail for cross-realm `struct` instances\n\t\t\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Value: `%s`.', obj.name, values[ i ] ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Compute the expected number of bytes per struct view:\n\t\tnb = obj.byteLength / obj.length; // note: as a field is expected to have a homogeneous data type, the byte length should be evenly divisible by the number of elements\n\n\t\t// Check that all struct instances have the same byte length...\n\t\tviews = [];\n\t\tfor ( i = 0; i < values.length; i++ ) {\n\t\t\tbuf = this.constructor.viewOf( values[ i ] );\n\t\t\tif ( buf.byteLength !== nb ) {\n\t\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be an array-like object containing `struct` instances having the same byte length.', obj.name ) );\n\t\t\t}\n\t\t\tsrc = new Uint8Array( buf.buffer, buf.byteOffset, nb );\n\t\t\tviews.push( src );\n\t\t}\n\t\t// Write the data for each `struct` to the underlying byte buffer...\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\toffset = view.byteOffset + obj.byteOffset;\n\t\tfor ( i = 0; i < values.length; i++ ) {\n\t\t\tdest = new Uint8Array( view.buffer, offset, nb );\n\t\t\tgcopy( obj.length, views[ i ], 1, dest, 1 );\n\t\t\toffset += nb;\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setStructArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 format = require( '@stdlib/string-format' );\nvar DATA_VIEW_METHODS = require( './data_view_methods.js' );\nvar setNumber = require( './set_number.js' );\nvar setComplex = require( './set_complex.js' );\nvar setBoolean = require( './set_boolean.js' );\nvar setBigInt = require( './set_bigint.js' );\nvar setStruct = require( './set_struct.js' );\nvar setTypedArray = require( './set_typedarray.js' );\nvar setStructArray = require( './set_struct_array.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function for setting field data.\n*\n* @private\n* @param {Object} obj - field object\n* @throws {Error} unexpected error\n* @returns {Function} function for setting field data\n*/\nfunction setter( obj ) {\n\tif ( obj.length ) {\n\t\tif ( obj.isStructType ) {\n\t\t\treturn setStructArray( obj );\n\t\t}\n\t\treturn setTypedArray( obj );\n\t}\n\tswitch ( obj.type ) {\n\tcase 'float64':\n\tcase 'float32':\n\tcase 'float16':\n\tcase 'int8':\n\tcase 'int16':\n\tcase 'int32':\n\tcase 'uint8':\n\tcase 'uint16':\n\tcase 'uint32':\n\t\treturn setNumber( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tcase 'int64':\n\tcase 'uint64':\n\t\treturn setBigInt( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tcase 'bool':\n\t\treturn setBoolean( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tcase 'complex128':\n\tcase 'complex64':\n\tcase 'complex32':\n\t\treturn setComplex( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tdefault:\n\t\tif ( obj.isStructType ) {\n\t\t\treturn setStruct( obj );\n\t\t}\n\t\t// Ensure that we fail loudly if we have failed to add support for newly added data types:\n\t\tthrow new Error( format( 'unexpected error. Unrecognized data type. Value: `%s`.', obj.type ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = setter;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable id-length */\n\n'use strict';\n\n// MODULES //\n\nvar setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar setNonEnumerableReadWriteAccessor = require( '@stdlib/utils-define-nonenumerable-read-write-accessor' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-read-only-accessor' );\nvar setReadWriteAccessor = require( '@stdlib/utils-define-read-write-accessor' );\nvar getter = require( './getter.js' );\nvar setter = require( './setter.js' );\n\n\n// MAIN //\n\n/**\n* Assigns methods for accessing field values to a provided prototype.\n*\n* @private\n* @param {Object} p - prototype\n* @param {Array} fields - field objects\n* @returns {Object} object containing accessors for each field\n*/\nfunction createPrototypeAccessors( p, fields ) {\n\tvar get;\n\tvar set;\n\tvar out;\n\tvar o;\n\tvar i;\n\n\tout = {};\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tget = getter( o );\n\t\tset = setter( o );\n\t\tif ( o.enumerable ) {\n\t\t\tif ( o.writable ) {\n\t\t\t\tsetReadWriteAccessor( p, o.name, get, set );\n\t\t\t} else {\n\t\t\t\tsetReadOnlyAccessor( p, o.name, get );\n\t\t\t}\n\t\t} else if ( o.writable ) {\n\t\t\tsetNonEnumerableReadWriteAccessor( p, o.name, get, set );\n\t\t} else {\n\t\t\tsetNonEnumerableReadOnlyAccessor( p, o.name, get );\n\t\t}\n\t\tout[ o.name ] = [ get, set ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = createPrototypeAccessors;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar FIELD_PROPERTIES = [\n\t'name',\n\t'type',\n\t'description',\n\t'length',\n\t'enumerable',\n\t'writable',\n\t'default',\n\t'castingMode'\n];\n\n\n// EXPORTS //\n\nmodule.exports = FIELD_PROPERTIES;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isCollection = require( '@stdlib/assert-is-collection' );\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating whether a field object represents a union type.\n*\n* @private\n* @param {Object} obj - input field object\n* @returns {boolean} result\n*/\nfunction isUnionType( obj ) {\n\treturn obj.type === 'union' && isCollection( obj.fields );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUnionType;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 hasProp = require( '@stdlib/assert-has-property' );\n\n\n// MAIN //\n\n/**\n* Tests whether an object has a list of properties.\n*\n* @private\n* @param {Object} obj - input object\n* @param {Array} keys - list of property names\n* @returns {boolean} result\n*/\nfunction hasProperties( obj, keys ) {\n\tvar i;\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tif ( !hasProp( obj, keys[ i ] ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasProperties;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid string field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidNonEmptyString( value, name ) {\n\tif ( isString( value ) || value.length > 0 ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a non-empty string. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isValidNonEmptyString;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid string field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidString( value, name ) {\n\tif ( isString( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a string. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isValidString;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid positive integer field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidPositiveInteger( value, name ) {\n\tif ( isPositiveInteger( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a positive integer. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isValidPositiveInteger;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid boolean field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidBoolean( value, name ) {\n\tif ( isBoolean( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a boolean. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isValidBoolean;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar DTYPES = [\n\t'int8',\n\t'int16',\n\t'int32',\n\t'int64',\n\n\t'uint8',\n\t'uint16',\n\t'uint32',\n\t'uint64',\n\n\t// 'float16', // TODO: uncomment once supported\n\n\t'float32',\n\t'float64',\n\n\t// 'complex32', // TODO: uncomment once supported\n\n\t'complex64',\n\t'complex128',\n\n\t'bool'\n];\n\n\n// EXPORTS //\n\nmodule.exports = DTYPES;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' );\nvar contains = require( '@stdlib/array-base-assert-contains' );\nvar join = require( '@stdlib/array-base-join' );\nvar format = require( '@stdlib/string-format' );\nvar DTYPES = require( './dtypes.js' );\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid `type` field.\n*\n* @private\n* @param {*} value - input value\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidType( value ) {\n\tif ( contains( DTYPES, value ) || isStructConstructorLike( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be either a struct type or one of the following: \"%s\". Value: `%s`.', 'type', join( DTYPES, ', ' ), value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isValidType;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 contains = require( '@stdlib/array-base-assert-contains' );\nvar join = require( '@stdlib/array-base-join' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether a provided value is a valid enumerated field.\n*\n* @private\n* @param {Collection} values - list of possible values\n* @returns {Function} output function\n*/\nfunction isValidOneOf( values ) {\n\treturn isValid;\n\n\t/**\n\t* Tests whether a provided value is a valid enumerated field.\n\t*\n\t* @private\n\t* @param {*} value - input value\n\t* @param {string} name - field name\n\t* @returns {(null|TypeError)} error object or null\n\t*/\n\tfunction isValid( value, name ) {\n\t\tif ( contains( values, value ) ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new TypeError( format( 'invalid argument. `%s` field must be one of the following: \"%s\". Value: `%s`.', name, join( values, ', ' ), value ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = isValidOneOf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Returns an initialized field object.\n*\n* @private\n* @returns {Object} initialized field object\n*/\nfunction initFieldObject() {\n\treturn {\n\t\t'isStructType': false,\n\t\t'description': '',\n\t\t'byteLength': 0,\n\t\t'byteOffset': 0,\n\t\t'alignment': 0,\n\t\t'padding': 0,\n\t\t'enumerable': true,\n\t\t'writable': true,\n\t\t'default': void 0, // explicitly set to `undefined`\n\t\t'castingMode': 'none'\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = initFieldObject;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );\n\n\n// MAIN //\n\n/**\n* Returns the number of bytes required to store a field value.\n*\n* @private\n* @param {Object} obj - input field object\n* @returns {PositiveInteger} number of bytes\n*/\nfunction byteLength( obj ) {\n\tvar nb;\n\tif ( obj.isStructType ) {\n\t\tnb = obj.type.byteLength;\n\t} else {\n\t\tnb = bytesPerElement( obj.type );\n\t}\n\tif ( obj.length ) {\n\t\tnb *= obj.length;\n\t}\n\treturn nb;\n}\n\n\n// EXPORTS //\n\nmodule.exports = byteLength;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar CASTING_MODES = [\n\t'none',\n\t'safe',\n\t'mostly-safe',\n\t'same-kind',\n\t'unsafe'\n];\n\n\n// EXPORTS //\n\nmodule.exports = CASTING_MODES;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar ALIGNMENTS = {\n\t'int8': 1,\n\t'int16': 2,\n\t'int32': 4,\n\t'int64': 8,\n\n\t'uint8': 1,\n\t'uint16': 2,\n\t'uint32': 4,\n\t'uint64': 8,\n\n\t'float16': 2,\n\t'float32': 4,\n\t'float64': 8,\n\n\t'complex32': 2, // same as float16\n\t'complex64': 4, // same as float32\n\t'complex128': 8, // same as float64\n\n\t'bool': 1\n};\n\n\n// EXPORTS //\n\nmodule.exports = ALIGNMENTS;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' );\nvar hasProp = require( '@stdlib/assert-has-property' );\nvar join = require( '@stdlib/array-base-join' );\nvar constantFunction = require( '@stdlib/utils-constant-function' );\nvar format = require( '@stdlib/string-format' );\nvar hasProperties = require( './has_properties.js' );\nvar isValidNonEmptyString = require( './is_valid_nonempty_string.js' );\nvar isValidString = require( './is_valid_string.js' );\nvar isValidPositiveInteger = require( './is_valid_positive_integer.js' );\nvar isValidBoolean = require( './is_valid_boolean.js' );\nvar isValidType = require( './is_valid_type.js' );\nvar isValidOneOf = require( './is_valid_one_of.js' );\nvar initFieldObject = require( './init_field_object.js' );\nvar byteLength = require( './byte_length.js' );\nvar CASTING_MODES = require( './casting_modes.js' );\nvar ALIGNMENTS = require( './alignments.js' );\n\n\n// VARIABLES //\n\nvar MANDATORY_FIELD_NAMES = [\n\t'name',\n\t'type'\n];\n\nvar VALIDATORS = {\n\t'name': isValidNonEmptyString,\n\t'type': isValidType,\n\t'description': isValidString,\n\t'length': isValidPositiveInteger,\n\t'enumerable': isValidBoolean,\n\t'writable': isValidBoolean,\n\t'default': constantFunction( null ),\n\t'castingMode': isValidOneOf( CASTING_MODES )\n};\n\n\n// MAIN //\n\n/**\n* Normalizes a provided field object.\n*\n* @private\n* @param {Object} obj - input field object\n* @param {Array} keys - list of keys to standardize\n* @returns {(Object|Error)} output object or an error\n*/\nfunction normalize( obj, keys ) {\n\tvar out;\n\tvar err;\n\tvar v;\n\tvar k;\n\tvar i;\n\n\tout = initFieldObject();\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tk = keys[ i ];\n\t\tif ( hasProp( obj, k ) ) {\n\t\t\tv = obj[ k ];\n\t\t\terr = VALIDATORS[ k ]( v, k );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\tout[ k ] = v;\n\t\t}\n\t}\n\tif ( !hasProperties( out, MANDATORY_FIELD_NAMES ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Field objects must have the following properties: \"%s\". Value: `%s`.', join( MANDATORY_FIELD_NAMES, ', ' ), JSON.stringify( obj ) ) );\n\t}\n\tout.isStructType = isStructConstructorLike( out.type );\n\tout.byteLength = byteLength( out );\n\tif ( out.isStructType ) {\n\t\tout.alignment = out.type.alignment;\n\t} else {\n\t\tout.alignment = ALIGNMENTS[ out.type ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = normalize;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Resolves the struct's byte alignment.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @returns {PositiveInteger} alignment\n*/\nfunction alignment( fields ) {\n\tvar max;\n\tvar v;\n\tvar i;\n\n\tmax = 0;\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\tv = fields[ i ].alignment;\n\t\tif ( v > max ) {\n\t\t\tmax = v;\n\t\t}\n\t}\n\treturn max;\n}\n\n\n// EXPORTS //\n\nmodule.exports = alignment;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isObject = require( '@stdlib/assert-is-object' );\nvar hasProp = require( '@stdlib/assert-has-property' );\nvar format = require( '@stdlib/string-format' );\nvar isUnionType = require( './is_union_type.js' );\nvar FIELD_PROPERTIES = require( './field_properties.js' );\nvar normalizeField = require( './normalize_field.js' );\nvar resolveAlignment = require( './resolve_alignment.js' );\n\n\n// MAIN //\n\n/**\n* Normalizes a field object representing a union type.\n*\n* @private\n* @param {Object} obj - input field object\n* @returns {(Object|null|Error)} normalized field object or error object\n*/\nfunction normalizeUnion( obj ) {\n\tvar fields;\n\tvar dflg;\n\tvar out;\n\tvar tmp;\n\tvar len;\n\tvar o;\n\tvar i;\n\n\tfields = obj.fields;\n\tif ( fields.length === 0 ) {\n\t\treturn null;\n\t}\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tif ( !isObject( o ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( isUnionType( o ) ) {\n\t\t\treturn new TypeError( format( 'invalid argument. Union types cannot contain nested union types. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t}\n\t\tif ( dflg === void 0 && hasProp( o, 'default' ) ) {\n\t\t\tdflg = true;\n\t\t} else if ( dflg === true && hasProp( o, 'default' ) ) {\n\t\t\treturn new TypeError( format( 'invalid argument. Union types can only contain one field with a default value. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t}\n\t\ttmp = normalizeField( o, FIELD_PROPERTIES );\n\t\tif ( tmp instanceof Error ) {\n\t\t\treturn tmp;\n\t\t}\n\t\tif ( i === 0 ) {\n\t\t\tlen = tmp.byteLength;\n\t\t} else if ( tmp.byteLength !== len ) {\n\t\t\treturn new RangeError( format( 'invalid argument. Union types must contain fields having the same byte length. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t}\n\t\tout.push( tmp );\n\t}\n\treturn {\n\t\t'type': 'union',\n\t\t'fields': out,\n\t\t'byteLength': len,\n\t\t'byteOffset': 0,\n\t\t'alignment': resolveAlignment( out ),\n\t\t'padding': 0\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = normalizeUnion;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isObject = require( '@stdlib/assert-is-object' );\nvar format = require( '@stdlib/string-format' );\nvar FIELD_PROPERTIES = require( './field_properties.js' );\nvar isUnionType = require( './is_union_type.js' );\nvar normalizeField = require( './normalize_field.js' );\nvar normalizeUnion = require( './normalize_union.js' );\n\n\n// MAIN //\n\n/**\n* Normalizes a list of field objects.\n*\n* @private\n* @param {Array} fields - input fields\n* @returns {(Array|Error)} normalized field objects or an error\n*/\nfunction normalize( fields ) {\n\tvar out;\n\tvar tmp;\n\tvar o;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tif ( !isObject( o ) ) {\n\t\t\treturn new TypeError( format( 'invalid argument. First argument must be an array of objects. Value: `%s`. Index: `%d`.', o, i ) );\n\t\t}\n\t\t// Check for a union type which is a collection of nested field objects which all have the same byte length...\n\t\tif ( isUnionType( o ) ) {\n\t\t\ttmp = normalizeUnion( o );\n\t\t\tif ( tmp === null ) {\n\t\t\t\treturn new TypeError( format( 'invalid argument. Union types must be an array of objects. Value: `%s`. Index: `%d`.', JSON.stringify( o ), i ) );\n\t\t\t}\n\t\t\tif ( tmp instanceof Error ) {\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t} else {\n\t\t\ttmp = normalizeField( o, FIELD_PROPERTIES );\n\t\t\tif ( tmp instanceof Error ) {\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t}\n\t\tout.push( tmp );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = normalize;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 format = require( '@stdlib/string-format' );\nvar isUnionType = require( './is_union_type.js' );\n\n\n// MAIN //\n\n/**\n* Resolves a list of field names.\n*\n* @private\n* @param {Array} fields - list of field objects\n* @returns {(Array|Error)} list of field names or an error\n*/\nfunction fieldNames( fields ) {\n\tvar hash;\n\tvar out;\n\tvar o1;\n\tvar o2;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\thash = {};\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to1 = fields[ i ];\n\t\tk = o1.name;\n\t\tif ( isUnionType( o1 ) ) {\n\t\t\tfor ( j = 0; j < o1.fields.length; j++ ) {\n\t\t\t\to2 = o1.fields[ j ];\n\t\t\t\tk = o2.name;\n\t\t\t\tif ( hash[ k ] === true ) {\n\t\t\t\t\treturn new TypeError( format( 'invalid argument. First argument must be an array of objects having unique field names. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t\t\t}\n\t\t\t\thash[ k ] = true;\n\t\t\t\tout.push( k );\n\t\t\t}\n\t\t} else if ( hash[ k ] === true ) {\n\t\t\treturn new TypeError( format( 'invalid argument. First argument must be an array of objects having unique field names. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t} else {\n\t\t\thash[ k ] = true;\n\t\t\tout.push( k );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fieldNames;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 indexOf = require( '@stdlib/array-base-index-of' );\nvar join = require( '@stdlib/array-base-join' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns the index of a specified field name in a provided list of field names.\n*\n* @private\n* @param {Array} names - list of field names\n* @param {string} name - field name\n* @throws {Error} struct must have at least one field\n* @throws {TypeError} must provide a recognized field name\n* @returns {(integer|Error)} index or an error object\n*/\nfunction fieldIndex( names, name ) {\n\tvar idx;\n\tif ( names.length === 0 ) {\n\t\treturn new Error( 'invalid operation. struct does not have any fields.' );\n\t}\n\tidx = indexOf( names, name, 0 );\n\tif ( idx < 0 ) {\n\t\treturn new TypeError( format( 'invalid argument. Field name must be one of the following: \"%s\". Value: `%s`.', join( names, ', ' ), name ) );\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fieldIndex;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 min = require( '@stdlib/math-base-special-fast-min' );\nvar isUnionType = require( './is_union_type.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Sets alignment padding for one or more field objects.\n*\n* ## Notes\n*\n* - This function mutates each field object.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @param {NonNegativeInteger} padding - alignment padding\n* @returns {Array} input array\n*/\nfunction setPadding( fields, padding ) {\n\tvar i;\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\tfields[ i ].padding = padding;\n\t}\n\treturn fields;\n}\n\n\n// MAIN //\n\n/**\n* Computes the byte offset for each field.\n*\n* ## Notes\n*\n* - This function mutates each field object.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @param {PositiveInteger} max - maximum alignment\n* @returns {Array} input array\n*/\nfunction byteOffsets( fields, max ) {\n\tvar alignment;\n\tvar padding;\n\tvar offset;\n\tvar tmp;\n\tvar o;\n\tvar i;\n\tvar j;\n\n\toffset = 0;\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// Resolve the alignment requirement for this field:\n\t\talignment = min( o.alignment, max );\n\n\t\t// Align the current offset to the required boundary:\n\t\tpadding = ( alignment-(offset%alignment) ) % alignment;\n\t\toffset += padding;\n\n\t\t// Set the padding for the previous member:\n\t\tif ( i > 0 ) {\n\t\t\ttmp = fields[ i-1 ];\n\t\t\ttmp.padding = padding;\n\t\t\tif ( isUnionType( o ) ) {\n\t\t\t\tsetPadding( tmp.fields, padding );\n\t\t\t}\n\t\t}\n\t\t// Set the offset for the current member:\n\t\to.byteOffset = offset;\n\n\t\t// If the current member is a union type, propagate the offset to its child field objects...\n\t\tif ( isUnionType( o ) ) {\n\t\t\tfor ( j = 0; j < o.fields.length; j++ ) {\n\t\t\t\to.fields[ j ].byteOffset = offset;\n\t\t\t}\n\t\t}\n\t\t// Advance the offset by the size, in bytes, of the member:\n\t\toffset += o.byteLength;\n\t}\n\t// Compute the padding for the last member:\n\tpadding = ( alignment - (offset%alignment) ) % alignment;\n\n\t// Set the padding for the last member:\n\to.padding = padding;\n\n\t// If the last member is a union type, propagate the offset to its child field objects...\n\tif ( isUnionType( o ) ) {\n\t\tsetPadding( o.fields, padding );\n\t}\n\n\treturn fields;\n}\n\n\n// EXPORTS //\n\nmodule.exports = byteOffsets;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Returns a list of partition indices.\n*\n* ## Notes\n*\n* - This function partitions field objects according to whether a field object represents a unique \"view\" over an underlying byte buffer. Field objects within a union belong to the same partition.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @returns {NonNegativeIntegerArray} list of indices\n*/\nfunction partitions( fields ) {\n\tvar out;\n\tvar N;\n\tvar o;\n\tvar i;\n\tvar j;\n\n\tN = fields.length;\n\n\tout = [];\n\tj = 0;\n\tfor ( i = 0; i < N-1; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// Check for the start of a union...\n\t\tif ( o.byteOffset === fields[ i+1 ].byteOffset ) {\n\t\t\tout.push( j );\n\t\t\tcontinue;\n\t\t}\n\t\tout.push( j );\n\t\tj += 1;\n\t}\n\t// Set the partition for the last field object:\n\tout.push( j );\n\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = partitions;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isUnionType = require( './is_union_type.js' );\n\n\n// MAIN //\n\n/**\n* Flattens a list of field objects.\n*\n* @private\n* @param {Array} fields - list of field objects\n* @returns {Array} new list\n*/\nfunction flatten( fields ) {\n\tvar out;\n\tvar o;\n\tvar i;\n\tvar j;\n\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tif ( isUnionType( o ) ) {\n\t\t\tfor ( j = 0; j < o.fields.length; j++ ) {\n\t\t\t\tout.push( o.fields[ j ] );\n\t\t\t}\n\t\t} else {\n\t\t\tout.push( o );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = flatten;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 floor = require( '@stdlib/math-base-special-floor' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Serializes a struct to a linear string format.\n*\n* ## Notes\n*\n* - The output format is a three-column format having the following layout:\n*\n* ```text\n* | byte_number | [field|padding] | notes |\n* ```\n*\n* - Nested `struct` instances are intentionally treated as opaque types, as we have limited access to struct internals (e.g., packed versus unpacked, field padding, etc), and we would effectively have to recompute all alignments and associated field data for the purposes of rendering. A user can always separately render a nested `struct` instance to a string in order to better understand its layout independently of its surrounding context in a parent `struct` instance.\n*\n* @private\n* @param {Function} Struct - struct constructor\n* @param {Array} fields - list of normalized fields\n* @returns {string} string representation\n*/\nfunction linearFormat( Struct, fields ) {\n\tvar nbytes;\n\tvar fmt0;\n\tvar fmt1;\n\tvar fmt2;\n\tvar bfmt;\n\tvar ufmt;\n\tvar fmt;\n\tvar tmp;\n\tvar out;\n\tvar flg;\n\tvar ib;\n\tvar c0;\n\tvar c1;\n\tvar c2;\n\tvar w0;\n\tvar w1;\n\tvar w;\n\tvar N;\n\tvar o;\n\tvar f;\n\tvar t;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tN = fields.length;\n\n\t// Resolve the size of the struct:\n\tnbytes = Struct.byteLength;\n\n\t// Compute the width of the first column:\n\tw0 = ( nbytes-1 ).toString().length;\n\n\t// Define a format string for the first column:\n\tfmt0 = '%'+w0+'s';\n\n\t// Determine the longest field name...\n\tw1 = 0;\n\tfor ( i = 0; i < N; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// Format: []\n\t\tw = o.name.length + 1 + ( o.byteLength-1 ).toString().length + 1;\n\t\tif ( w > w1 ) {\n\t\t\tw1 = w;\n\t\t}\n\t}\n\t// Define a format string for the second column:\n\tfmt1 = '%'+w1+'s';\n\n\t// Define a format string for the third column:\n\tfmt2 = '// %s';\n\n\t// Define a format string which combines the columns:\n\tfmt = '%s: %s %s';\n\n\t// Initialize a byte counter:\n\tib = 0;\n\n\tout = [];\n\tfor ( i = 0; i < N; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// If we are currently processing fields in a union, move along to the next non-union field...\n\t\tif ( i > 0 && ( o.byteOffset === fields[ i-1 ].byteOffset ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\t// Check whether this field is the first field of a union...\n\t\tif ( i < N-1 ) {\n\t\t\tflg = ( o.byteOffset === fields[ i+1 ].byteOffset );\n\t\t} else {\n\t\t\tflg = false;\n\t\t}\n\t\tfor ( j = 0; j < o.byteLength; j++ ) {\n\t\t\t// In the first column, render the byte number:\n\t\t\tc0 = format( fmt0, ib.toString() );\n\n\t\t\t// In the second column, render the field name and the byte number relative to the field:\n\t\t\tc1 = format( fmt1, format( '%s[%u]', o.name, j ) );\n\n\t\t\t// If a field type spans multiple bytes, render the byte number:\n\t\t\tif ( o.alignment > 1 ) {\n\t\t\t\tbfmt = ' (byte %u)';\n\t\t\t} else {\n\t\t\t\tbfmt = '';\n\t\t\t}\n\t\t\t// If a field is part of a union, make that explicit:\n\t\t\tif ( flg ) {\n\t\t\t\tufmt = ' => union: %s';\n\t\t\t\ttmp = [];\n\t\t\t\tk = i + 1;\n\t\t\t\twhile ( k < N && o.byteOffset === fields[ k ].byteOffset ) {\n\t\t\t\t\tf = fields[ k ];\n\t\t\t\t\tif ( f.isStructType ) {\n\t\t\t\t\t\tt = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tt = f.type;\n\t\t\t\t\t}\n\t\t\t\t\ttmp.push( format( '%s<%s>[%u]', f.name, t, j%f.alignment ) );\n\t\t\t\t\tk += 1;\n\t\t\t\t}\n\t\t\t\tufmt = format( ufmt, tmp.join( ', ' ) );\n\t\t\t} else {\n\t\t\t\tufmt = '';\n\t\t\t}\n\t\t\ttmp = format( bfmt+ufmt, j%o.alignment );\n\n\t\t\t// If a field contains multiple elements (i.e., is an array), render the field type along with the element number:\n\t\t\tif ( o.length ) {\n\t\t\t\tc2 = format( fmt2, format( '%s[%u]%s', o.type, floor( j/o.alignment ), tmp ) );\n\t\t\t}\n\t\t\t// Otherwise, just render the field type:\n\t\t\telse {\n\t\t\t\tc2 = format( fmt2, format( '%s%s', o.type, tmp ) );\n\t\t\t}\n\t\t\t// Render the row string:\n\t\t\tout.push( format( fmt, c0, c1, c2 ) );\n\t\t\tib += 1;\n\t\t}\n\t\tfor ( j = 0; j < o.padding; j++ ) {\n\t\t\tc0 = format( fmt0, ib.toString() );\n\t\t\tc1 = format( fmt1, '--' );\n\t\t\tc2 = format( fmt2, 'padding' );\n\t\t\tout.push( format( fmt, c0, c1, c2 ) );\n\t\t\tib += 1;\n\t\t}\n\t}\n\treturn out.join( '\\n' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = linearFormat;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 replace = require( '@stdlib/string-base-replace' );\nvar format = require( '@stdlib/string-format' );\n\n\n// FUNCTIONS //\n\n/**\n* Returns a new regular expression for matching byte parameters.\n*\n* @private\n* @returns {RegExp} regular expression\n*/\nfunction reByteOffset() {\n\treturn /\\[(\\d{1,}),/g;\n}\n\n/**\n* Returns a function for replacing byte values in a serialized struct.\n*\n* @private\n* @param {NonNegativeInteger} offset - byte offset\n* @returns {Function} replacer function\n*/\nfunction replacer( offset ) {\n\treturn wrapped;\n\n\t/**\n\t* Callback invoked for each match.\n\t*\n\t* @private\n\t* @param {string} match - matched substring\n\t* @param {string} p1 - first matched capture group substring\n\t* @returns {string} replacement string\n\t*/\n\tfunction wrapped( match, p1 ) {\n\t\treturn format( '[%u,', offset+parseInt( p1, 10 ) );\n\t}\n}\n\n\n// MAIN //\n\n/**\n* Serializes a struct to a layout format.\n*\n* ## Notes\n*\n* - The output format is a multi-column format having the following layout:\n*\n* ```text\n* | ...[byte_offset,byte_length] |\n* ```\n*\n* For example,\n*\n* ```text\n* |[0,8]|[8,1]|[16,16]|[32,8]|\n* ```\n*\n* @private\n* @param {Array} fields - list of normalized fields\n* @returns {string} string representation\n*/\nfunction layoutFormat( fields ) {\n\tvar out;\n\tvar tmp;\n\tvar re;\n\tvar N;\n\tvar o;\n\tvar i;\n\n\tN = fields.length;\n\n\t// Create a new regular expression for matching byte offsets:\n\tre = reByteOffset();\n\n\tout = [];\n\tfor ( i = 0; i < N; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// If we are currently processing fields in a union, move along to the next non-union field...\n\t\tif ( i > 0 && ( o.byteOffset === fields[ i-1 ].byteOffset ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\t// If the current type is a struct, we need to serialize and then post-process...\n\t\tif ( o.isStructType ) {\n\t\t\tout.push( replace( o.type.layout, re, replacer( o.byteOffset ) ) );\n\t\t\tcontinue;\n\t\t}\n\t\t// Format the field data:\n\t\tout.push( format( '|<%s>[%u,%u]', o.type, o.byteOffset, o.byteLength ) );\n\t}\n\ttmp = format( '%s|', out.join( '' ) );\n\n\t// If we having a trailing `||` due to a nested struct, remove the final `|`:\n\tif ( tmp[ tmp.length-2 ] === '|' ) {\n\t\ttmp = tmp.substring( 0, tmp.length-1 );\n\t}\n\treturn tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = layoutFormat;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isPlainObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar contains = require( '@stdlib/array-base-assert-contains' ).factory;\nvar join = require( '@stdlib/array-base-join' );\nvar format = require( '@stdlib/string-format' );\nvar linearFormat = require( './format_linear.js' );\nvar layoutFormat = require( './format_layout.js' );\n\n\n// VARIABLES //\n\nvar FORMATS = [\n\t'none',\n\t'linear',\n\t'layout'\n];\nvar isFormat = contains( FORMATS );\n\n\n// MAIN //\n\n/**\n* Serializes a struct to a string.\n*\n* @private\n* @param {Function} Struct - struct constructor\n* @param {Array} fields - list of normalized fields\n* @param {Options} options - function options\n* @param {string} [options.format] - serialization format\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} string representation\n*/\nfunction toString( Struct, fields, options ) { // eslint-disable-line stdlib/no-redeclare\n\tvar opts;\n\tif ( !isPlainObject( options ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\topts = {\n\t\t'format': 'none'\n\t};\n\tif ( hasOwnProp( options, 'format' ) ) {\n\t\topts.format = options.format;\n\t\tif ( !isFormat( opts.format ) ) {\n\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'format', join( FORMATS, ', ' ), options.format ) );\n\t\t}\n\t}\n\tif ( opts.format === 'linear' ) {\n\t\treturn linearFormat( Struct, fields );\n\t}\n\tif ( opts.format === 'layout' ) {\n\t\treturn layoutFormat( fields );\n\t}\n\t// Case: opts.format === 'none'\n\treturn '';\n}\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isCollection = require( '@stdlib/assert-is-collection' );\nvar isComplexLike = require( '@stdlib/assert-is-complex-like' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar typedarray2json = require( '@stdlib/array-to-json' );\nvar isStructInstance = require( './is_struct_instance.js' );\n\n\n// MAIN //\n\n/**\n* Serializes a `struct` instance to JSON.\n*\n* @private\n* @param {Struct} struct - struct instance\n* @param {Array} fields - list of normalized fields\n* @returns {Object} JSON representation\n*/\nfunction toJSON( struct, fields ) {\n\tvar out;\n\tvar o;\n\tvar v;\n\tvar i;\n\n\tout = {};\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tv = struct[ o.name ];\n\t\tif ( isCollection( v ) ) {\n\t\t\tv = typedarray2json( v );\n\t\t} else if ( isStructInstance( v ) ) {\n\t\t\tv = v.toJSON();\n\t\t} else if ( isComplexLike( v ) && isFunction( v.toJSON ) ) {\n\t\t\tv = v.toJSON();\n\t\t}\n\t\tout[ o.name ] = v;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = toJSON;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-restricted-syntax, id-length, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' );\nvar isObject = require( '@stdlib/assert-is-object' );\nvar hasProp = require( '@stdlib/assert-has-property' );\nvar min = require( '@stdlib/math-base-special-fast-min' );\nvar filled = require( '@stdlib/array-base-filled' );\nvar ArrayBuffer = require( '@stdlib/array-buffer' );\nvar DataView = require( '@stdlib/array-dataview' );\nvar format = require( '@stdlib/string-format' );\nvar PRIVATE_BUFFER = require( './private_buffer.js' );\nvar CTOR_NAME = require( './ctor_name.js' );\nvar createPrototypeAccessors = require( './create_prototype_accessors.js' );\nvar isStructInstance = require( './is_struct_instance.js' );\nvar normalize = require( './normalize_field_list.js' );\nvar fieldNames = require( './field_names.js' );\nvar fieldIndex = require( './field_index.js' );\nvar resolveAlignment = require( './resolve_alignment.js' );\nvar byteOffsets = require( './byte_offsets.js' );\nvar partitions = require( './partitions.js' );\nvar flatten = require( './flatten_fields.js' );\nvar struct2string = require( './to_string.js' );\nvar struct2json = require( './to_json.js' );\nvar layoutFormat = require( './format_layout.js' );\n\n\n// MAIN //\n\n/**\n* Returns a constructor for creating a fixed-width composite data type (a.k.a., a `struct`).\n*\n* @param {ObjectArray} fields - structure fields\n* @throws {TypeError} first argument must be an array-like object containing objects\n* @throws {TypeError} field objects must have required properties\n* @throws {TypeError} field objects must have valid fields\n* @throws {TypeError} union types must be array-like objects containing objects\n* @throws {RangeError} union types must contain fields having the same byte length\n* @throws {TypeError} union types cannot contain nested union types\n* @throws {TypeError} union types can only contain one field with a default value\n* @throws {Error} unexpected error\n* @returns {Function} constructor\n*\n* @example\n* var fields = [\n* {\n* 'type': 'union',\n* 'fields': [\n* {\n* 'name': 'double',\n* 'description': 'double-precision floating-point number',\n* 'type': 'float64',\n* 'enumerable': true,\n* 'writable': true,\n* 'castingMode': 'none'\n* },\n* {\n* 'name': 'words',\n* 'description': 'high and low words',\n* 'type': 'uint32',\n* 'length': 2,\n* 'enumerable': true,\n* 'writable': true,\n* 'castingMode': 'none'\n* }\n* ]\n* }\n* ];\n* var Struct = factory( fields );\n*\n* var data = {\n* 'double': 3.14\n* };\n* var s = new Struct( data );\n* // returns \n*\n* var v = s.double;\n* // returns 3.14\n*\n* var w = s.words;\n* // e.g., [ 1374389535, 1074339512 ]\n*/\nfunction factory( fields ) {\n\tvar FIELD_NAMES;\n\tvar BYTE_LENGTH;\n\tvar PARTITIONS;\n\tvar ALIGNMENT;\n\tvar ACCESSORS;\n\tvar FIELDS;\n\tvar tmp;\n\tvar o;\n\tif ( !isCollection( fields ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', fields ) );\n\t}\n\t// Normalize the list of field objects:\n\ttmp = normalize( fields );\n\tif ( tmp instanceof Error ) {\n\t\tthrow tmp;\n\t}\n\tFIELDS = tmp;\n\n\t// Resolve the list of unique field names:\n\ttmp = fieldNames( FIELDS );\n\tif ( tmp instanceof Error ) {\n\t\tthrow tmp;\n\t}\n\tFIELD_NAMES = tmp;\n\n\t// Resolve the struct's alignment requirements:\n\tALIGNMENT = resolveAlignment( FIELDS );\n\n\t// Compute the byte offset for each field:\n\tFIELDS = byteOffsets( FIELDS, ALIGNMENT );\n\n\t// Now that we've finished processing provided field objects, flatten the list, such that union types are implied by field objects having the same byte offset:\n\tFIELDS = flatten( FIELDS );\n\n\t// Compute field \"partitions\" (i.e., non-overlapping views):\n\tPARTITIONS = partitions( FIELDS );\n\n\t// Compute the struct's byte length:\n\to = FIELDS[ FIELDS.length-1 ];\n\tBYTE_LENGTH = o.byteOffset + o.byteLength + o.padding;\n\n\t/**\n\t* Constructor for a composite data type (a.k.a., a `struct`).\n\t*\n\t* @private\n\t* @param {(Object|ArrayBuffer)} [arg] - array buffer or data object\n\t* @param {NonNegativeInteger} [byteOffset=0] - offset, in bytes, to the first byte in a provided buffer for the returned `struct` to reference\n\t* @param {NonNegativeInteger} [byteLength] - maximum number of elements in the byte array\n\t* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n\t* @throws {TypeError} second argument must be a nonnegative integer\n\t* @throws {TypeError} third argument must be a nonnegative integer\n\t* @throws {Error} union types may only be initialized by a single member\n\t* @returns {Struct} struct instance\n\t*/\n\tfunction Struct( arg, byteOffset, byteLength ) {\n\t\tvar values;\n\t\tvar nargs;\n\t\tvar cache;\n\t\tvar view;\n\t\tvar obj;\n\t\tvar o;\n\t\tvar v;\n\t\tvar i;\n\t\tvar j;\n\t\tvar k;\n\n\t\tnargs = arguments.length;\n\t\tif ( !( this instanceof Struct ) ) {\n\t\t\tif ( nargs === 0 ) {\n\t\t\t\treturn new Struct();\n\t\t\t}\n\t\t\tif ( nargs === 1 ) {\n\t\t\t\treturn new Struct( arg );\n\t\t\t}\n\t\t\tif ( nargs === 2 ) {\n\t\t\t\treturn new Struct( arg, byteOffset );\n\t\t\t}\n\t\t\treturn new Struct( arg, byteOffset, byteLength );\n\t\t}\n\t\tif ( isArrayBuffer( arg ) ) {\n\t\t\tif ( nargs === 1 ) {\n\t\t\t\tview = new DataView( arg, 0, BYTE_LENGTH );\n\t\t\t} else {\n\t\t\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t\t\t}\n\t\t\t\tif ( nargs === 2 ) {\n\t\t\t\t\tview = new DataView( arg, byteOffset, BYTE_LENGTH );\n\t\t\t\t} else {\n\t\t\t\t\tif ( !isNonNegativeInteger( byteLength ) ) {\n\t\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Byte length must be a nonnegative integer. Value: `%s`.', byteLength ) );\n\t\t\t\t\t}\n\t\t\t\t\tview = new DataView( arg, byteOffset, min( byteLength, BYTE_LENGTH ) ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( view.byteLength < BYTE_LENGTH ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer has insufficient capacity. Minimum capacity: `%u`.', BYTE_LENGTH ) );\n\t\t\t}\n\t\t} else {\n\t\t\tview = new DataView( new ArrayBuffer( BYTE_LENGTH ) );\n\t\t\tif ( nargs > 0 ) {\n\t\t\t\tif ( !isObject( arg ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\tobj = arg;\n\t\t\t}\n\t\t}\n\t\t// Bind the byte buffer to the current instance:\n\t\tsetReadOnly( this, PRIVATE_BUFFER, view );\n\n\t\t// If we were provided a data object, set provided fields...\n\t\tif ( obj !== void 0 ) {\n\t\t\t// Initialize an array containing values to set:\n\t\t\tvalues = filled( void 0, FIELDS.length );\n\n\t\t\t// For each field, determine whether a value has been specified...\n\t\t\tcache = {};\n\t\t\tfor ( i = 0; i < FIELDS.length; i++ ) {\n\t\t\t\tk = FIELD_NAMES[ i ];\n\t\t\t\tj = PARTITIONS[ i ];\n\t\t\t\tif ( hasProp( obj, k ) ) {\n\t\t\t\t\t// Check whether a value has already been specified for this view (i.e., via another union member)...\n\t\t\t\t\tif ( cache[ j ] ) {\n\t\t\t\t\t\tthrow new Error( 'invalid argument. Union types may only be initialized by a single member.' );\n\t\t\t\t\t}\n\t\t\t\t\tvalues[ i ] = obj[ k ];\n\t\t\t\t\tcache[ j ] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Perform a second pass over the fields to fill in default initial values...\n\t\t\tfor ( i = 0; i < FIELDS.length; i++ ) {\n\t\t\t\tj = PARTITIONS[ i ];\n\t\t\t\tif ( cache[ j ] ) {\n\t\t\t\t\t// Skip fields already having initial values...\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\to = FIELDS[ i ];\n\t\t\t\tif ( o.default !== void 0 ) {\n\t\t\t\t\tvalues[ i ] = o.default;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Set all fields with initialization values...\n\t\t\tfor ( i = 0; i < FIELDS.length; i++ ) {\n\t\t\t\tv = values[ i ];\n\t\t\t\tif ( v !== void 0 ) {\n\t\t\t\t\tACCESSORS[ FIELD_NAMES[ i ] ][ 1 ].call( this, v );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t* Constructor name.\n\t*\n\t* @private\n\t* @name name\n\t* @memberof Struct\n\t* @readonly\n\t* @type {string}\n\t* @default 'Struct'\n\t*/\n\tsetReadOnly( Struct, 'name', CTOR_NAME );\n\n\t/**\n\t* Alignment.\n\t*\n\t* @private\n\t* @name alignment\n\t* @memberof Struct\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( Struct, 'alignment', ALIGNMENT );\n\n\t/**\n\t* Size (in bytes) of the `struct`.\n\t*\n\t* @private\n\t* @name byteLength\n\t* @memberof Struct\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( Struct, 'byteLength', BYTE_LENGTH );\n\n\t/**\n\t* Returns a list of `struct` fields.\n\t*\n\t* @private\n\t* @name fields\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Array}\n\t*/\n\tsetNonEnumerableReadOnlyAccessor( Struct, 'fields', function get() {\n\t\treturn FIELD_NAMES.slice();\n\t});\n\n\t/**\n\t* Returns a string corresponding to the `struct` layout.\n\t*\n\t* @private\n\t* @name layout\n\t* @memberof Struct\n\t* @readonly\n\t* @type {string}\n\t*/\n\tsetNonEnumerableReadOnlyAccessor( Struct, 'layout', function get() {\n\t\t// As this is not likely to be a commonly used API, intentionally recompute the layout format in order to avoid consuming memory for what could be a long string...\n\t\treturn layoutFormat( FIELDS );\n\t});\n\n\t/**\n\t* Returns the underlying byte buffer of a `struct`.\n\t*\n\t* @private\n\t* @name bufferOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {Object} obj - struct instance\n\t* @throws {TypeError} must provide a `struct` instance\n\t* @returns {ArrayBuffer} underlying byte buffer\n\t*/\n\tsetReadOnly( Struct, 'bufferOf', function bufferOf( obj ) {\n\t\tif ( !isStructInstance( obj ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a `struct` instance. Value: `%s`.', obj ) );\n\t\t}\n\t\treturn obj[ PRIVATE_BUFFER ].buffer;\n\t});\n\n\t/**\n\t* Returns the length, in bytes, of the value specified by the provided field name.\n\t*\n\t* @private\n\t* @name byteLengthOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {NonNegativeInteger} byte length\n\t*/\n\tsetReadOnly( Struct, 'byteLengthOf', function byteLengthOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].byteLength;\n\t});\n\n\t/**\n\t* Returns the offset, in bytes, from the beginning of a `struct` to the value specified by the provided field name.\n\t*\n\t* @private\n\t* @name byteOffsetOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {NonNegativeInteger} byte offset\n\t*/\n\tsetReadOnly( Struct, 'byteOffsetOf', function byteOffsetOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].byteOffset;\n\t});\n\n\t/**\n\t* Returns the description associated with a provided field name.\n\t*\n\t* @private\n\t* @name descriptionOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {string} description\n\t*/\n\tsetReadOnly( Struct, 'descriptionOf', function descriptionOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].description;\n\t});\n\n\t/**\n\t* Returns a boolean indicating whether a provided value is a `struct` instance.\n\t*\n\t* @private\n\t* @name isStruct\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {*} value - input value\n\t* @returns {boolean} boolean indicating whether a value is a `struct` instance\n\t*/\n\tsetReadOnly( Struct, 'isStruct', function isStruct( value ) {\n\t\treturn (\n\t\t\tvalue instanceof Struct ||\n\t\t\t(\n\t\t\t\tisStructInstance( value ) &&\n\t\t\t\tisStructConstructorLike( value.constructor )\n\t\t\t)\n\t\t);\n\t});\n\n\t/**\n\t* Returns the type associated with a provided field name.\n\t*\n\t* @private\n\t* @name typeOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {(string|Object)} type\n\t*/\n\tsetReadOnly( Struct, 'typeOf', function typeOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].type;\n\t});\n\n\t/**\n\t* Returns the underlying byte buffer of a `struct` as a `DataView`.\n\t*\n\t* @private\n\t* @name viewOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {Object} obj - struct instance\n\t* @throws {TypeError} must provide a `struct` instance\n\t* @returns {DataView} view of underlying byte buffer\n\t*/\n\tsetReadOnly( Struct, 'viewOf', function viewOf( obj ) {\n\t\tvar buf;\n\t\tif ( !isStructInstance( obj ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a `struct` instance. Value: `%s`.', obj ) );\n\t\t}\n\t\tbuf = obj[ PRIVATE_BUFFER ];\n\t\treturn new DataView( buf.buffer, buf.byteOffset, buf.byteLength );\n\t});\n\n\t// Create prototype accessors for getting and setting field values:\n\tACCESSORS = createPrototypeAccessors( Struct.prototype, FIELDS );\n\n\t/**\n\t* Serializes a `struct` to a string.\n\t*\n\t* @private\n\t* @name toString\n\t* @memberof Struct.prototype\n\t* @readonly\n\t* @type {Function}\n\t* @param {Options} [options] - function options\n\t* @param {string} [options.format='none'] - serialization format\n\t* @throws {Error} `this` must be a struct instance\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {string} serialized `struct` instance\n\t*/\n\tsetReadOnly( Struct.prototype, 'toString', function toString() {\n\t\tvar opts;\n\t\tif ( !( this instanceof Struct ) ) {\n\t\t\tthrow new Error( 'invalid invocation. `this` is not a struct instance.' );\n\t\t}\n\t\tif ( arguments.length > 0 ) {\n\t\t\topts = arguments[ 0 ];\n\t\t} else {\n\t\t\topts = {};\n\t\t}\n\t\treturn struct2string( Struct, FIELDS, opts );\n\t});\n\n\t/**\n\t* Serializes a `struct` to JSON.\n\t*\n\t* @private\n\t* @name toJSON\n\t* @memberof Struct.prototype\n\t* @readonly\n\t* @type {Function}\n\t* @throws {Error} `this` must be a struct instance\n\t* @returns {JSON} serialized `struct` instance\n\t*/\n\tsetReadOnly( Struct.prototype, 'toJSON', function toJSON() {\n\t\tif ( !( this instanceof Struct ) ) {\n\t\t\tthrow new Error( 'invalid invocation. `this` is not a struct instance.' );\n\t\t}\n\t\treturn struct2json( this, FIELDS );\n\t});\n\n\treturn Struct;\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create a constructor for creating a fixed-width composite data type (a.k.a., a `struct`).\n*\n* @module @stdlib/dstructs-struct\n*\n* @example\n* var factory = require( '@stdlib/dstructs-struct' );\n*\n* var fields = [\n* {\n* 'type': 'union',\n* 'fields': [\n* {\n* 'name': 'double',\n* 'description': 'double-precision floating-point number',\n* 'type': 'float64',\n* 'enumerable': true,\n* 'writable': true,\n* 'castingMode': 'none'\n* },\n* {\n* 'name': 'words',\n* 'description': 'high and low words',\n* 'type': 'uint32',\n* 'length': 2,\n* 'enumerable': true,\n* 'writable': true,\n* 'castingMode': 'none'\n* }\n* ]\n* }\n* ];\n* var Struct = factory( fields );\n*\n* var data = {\n* 'double': 3.14\n* };\n* var s = new Struct( data );\n* // returns \n*\n* var v = s.double;\n* // returns 3.14\n*\n* var w = s.words;\n* // e.g., [ 1374389535, 1074339512 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "iIAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,GAAA,cAuBA,IAAIC,GAAiB,wCAKrBD,GAAO,QAAUC,KC5BjB,IAAAC,GAAAC,EAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,GAAY,SAKhBD,GAAO,QAAUC,KC3BjB,IAAAC,EAAAC,EAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,GAAoB,CACvB,KAAQ,CACP,IAAO,UACP,IAAO,SACR,EACA,MAAS,CACR,IAAO,WACP,IAAO,UACR,EACA,MAAS,CACR,IAAO,WACP,IAAO,UACR,EACA,MAAS,CACR,IAAO,cACP,IAAO,aACR,EACA,MAAS,CACR,IAAO,WACP,IAAO,UACR,EACA,OAAU,CACT,IAAO,YACP,IAAO,WACR,EACA,OAAU,CACT,IAAO,YACP,IAAO,WACR,EACA,OAAU,CACT,IAAO,eACP,IAAO,cACR,EACA,QAAW,CACV,IAAO,aACP,IAAO,YACR,EACA,QAAW,CACV,IAAO,aACP,IAAO,YACR,EACA,QAAW,CACV,IAAO,aACP,IAAO,YACR,EACA,UAAa,CACZ,IAAO,aACP,IAAO,YACR,EACA,UAAa,CACZ,IAAO,aACP,IAAO,YACR,EACA,WAAc,CACb,IAAO,aACP,IAAO,YACR,EACA,KAAQ,CACP,IAAO,WACP,IAAO,UACR,CACD,EAKAD,GAAO,QAAUC,KCxFjB,IAAAC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C,CAAM,GACxBlD,GAAyBkD,EAAM,WAAY,CAG9C,CAAC,EAeDpD,EAAaqC,EAAQ,SAAU,SAAiBa,EAAO,CACtD,IAAIC,EAAMhC,EAAYU,EAAaqB,CAAK,EACxC,GAAKC,aAAe,MACnB,MAAMA,EAEP,OAAOjB,EAAQiB,CAAI,EAAE,IACtB,CAAC,EAcDnD,EAAaqC,EAAQ,SAAU,SAAiBQ,EAAM,CACrD,IAAIQ,EACJ,GAAK,CAACrC,GAAkB6B,CAAI,EAC3B,MAAM,IAAI,UAAWjC,EAAQ,6EAA8EiC,CAAI,CAAE,EAElH,OAAAQ,EAAMR,EAAKhC,EAAe,EACnB,IAAIF,EAAU0C,EAAI,OAAQA,EAAI,WAAYA,EAAI,UAAW,CACjE,CAAC,EAGDpB,EAAYlB,GAA0BsB,EAAO,UAAWH,CAAO,EAiB/DlC,EAAaqC,EAAO,UAAW,WAAY,UAAoB,CAC9D,IAAIiB,EACJ,GAAK,EAAG,gBAAgBjB,GACvB,MAAM,IAAI,MAAO,sDAAuD,EAEzE,OAAK,UAAU,OAAS,EACvBiB,EAAO,UAAW,CAAE,EAEpBA,EAAO,CAAC,EAEF9B,GAAea,EAAQH,EAAQoB,CAAK,CAC5C,CAAC,EAaDtD,EAAaqC,EAAO,UAAW,SAAU,UAAkB,CAC1D,GAAK,EAAG,gBAAgBA,GACvB,MAAM,IAAI,MAAO,sDAAuD,EAEzE,OAAOZ,GAAa,KAAMS,CAAO,CAClC,CAAC,EAEMG,CACR,CAKAtC,GAAO,QAAU4B,KCrcjB,IAAI4B,GAAO,KAKX,OAAO,QAAUA", - "names": ["require_private_buffer", "__commonJSMin", "exports", "module", "PRIVATE_BUFFER", "require_ctor_name", "__commonJSMin", "exports", "module", "CTOR_NAME", "require_data_view_methods", "__commonJSMin", "exports", "module", "DATA_VIEW_METHODS", "require_get_number", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "PRIVATE_BUFFER", "getNumber", "obj", "method", "getter", "view", "require_get_boolean", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "Boolean", "PRIVATE_BUFFER", "getBoolean", "obj", "method", "getter", "view", "require_get_complex", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "complex", "PRIVATE_BUFFER", "CMPLX_TO_REAL", "getComplex", "obj", "method", "getter", "view", "re", "im", "require_get_bigint", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "PRIVATE_BUFFER", "getBigInt", "obj", "method", "getter", "view", "require_get_struct", "__commonJSMin", "exports", "module", "PRIVATE_BUFFER", "getStruct", "obj", "getter", "view", "require_get_typedarray", "__commonJSMin", "exports", "module", "typedarray", "PRIVATE_BUFFER", "getTypedArray", "obj", "getter", "view", "require_get_struct_array", "__commonJSMin", "exports", "module", "PRIVATE_BUFFER", "getStructArray", "obj", "getter", "offset", "view", "out", "i", "require_getter", "__commonJSMin", "exports", "module", "format", "DATA_VIEW_METHODS", "getNumber", "getBoolean", "getComplex", "getBigInt", "getStruct", "getTypedArray", "getStructArray", "getter", "obj", "require_boolean2number", "__commonJSMin", "exports", "module", "boolean2number", "value", "require_bigint2number", "__commonJSMin", "exports", "module", "Number", "bigint2number", "value", "require_defaults", "__commonJSMin", "exports", "module", "require_set_number", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "isRealFloatingPointDataType", "isSignedIntegerDataType", "isNumber", "isBoolean", "isInteger", "isBigInt", "isComplexLike", "isAllowedCast", "minDataType", "minSignedIntegerDataType", "complexDType", "format", "boolean2number", "bigint2number", "PRIVATE_BUFFER", "defaults", "setNumber", "obj", "method", "setter", "value", "view", "dt", "v", "require_set_complex", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "isNumber", "isBoolean", "isBigInt", "isComplexLike", "isAllowedCast", "complexDType", "format", "boolean2number", "bigint2number", "PRIVATE_BUFFER", "setComplex", "obj", "method", "setter", "value", "view", "dt", "re", "im", "require_number2boolean", "__commonJSMin", "exports", "module", "Boolean", "number2boolean", "value", "require_complex2boolean", "__commonJSMin", "exports", "module", "Boolean", "complex2boolean", "value", "require_bigint2boolean", "__commonJSMin", "exports", "module", "Boolean", "bigint2boolean", "value", "require_set_boolean", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "isNumber", "isBoolean", "isBigInt", "isComplexLike", "isAllowedCast", "complexDType", "Boolean", "format", "PRIVATE_BUFFER", "boolean2number", "number2boolean", "complex2boolean", "bigint2boolean", "defaults", "setBoolean", "obj", "method", "setter", "value", "view", "dt", "v", "require_boolean2bigint", "__commonJSMin", "exports", "module", "BigInt", "boolean2bigint", "value", "require_set_bigint", "__commonJSMin", "exports", "module", "IS_LITTLE_ENDIAN", "isNumber", "isBoolean", "isInteger", "isBigInt", "isComplexLike", "isAllowedCast", "minDataType", "complexDType", "BigInt", "Number", "floor", "format", "PRIVATE_BUFFER", "boolean2bigint", "defaults", "setBigInt", "obj", "method", "setter", "value", "view", "dt", "v", "require_is_struct_instance", "__commonJSMin", "exports", "module", "isDataView", "isObject", "PRIVATE_BUFFER", "isStructInstance", "value", "require_set_struct", "__commonJSMin", "exports", "module", "Uint8Array", "gcopy", "format", "PRIVATE_BUFFER", "isStructInstance", "setStruct", "obj", "setter", "value", "view", "dest", "src", "buf", "nb", "require_complex2number", "__commonJSMin", "exports", "module", "complex2number", "value", "require_set_typedarray", "__commonJSMin", "exports", "module", "isCollection", "isAllowedCast", "isComplexDataType", "isBooleanDataType", "isRealDataType", "typedarray", "dtype", "reinterpretComplex", "reinterpretBoolean", "gcopy", "gfill", "map", "format", "PRIVATE_BUFFER", "isStructInstance", "number2boolean", "complex2boolean", "complex2number", "setTypedArray", "obj", "setter", "value", "view", "buf", "dt", "require_set_struct_array", "__commonJSMin", "exports", "module", "isCollection", "Uint8Array", "gcopy", "format", "PRIVATE_BUFFER", "setStructArray", "obj", "setter", "values", "offset", "views", "view", "dest", "src", "buf", "nb", "i", "require_setter", "__commonJSMin", "exports", "module", "format", "DATA_VIEW_METHODS", "setNumber", "setComplex", "setBoolean", "setBigInt", "setStruct", "setTypedArray", "setStructArray", "setter", "obj", "require_create_prototype_accessors", "__commonJSMin", "exports", "module", "setNonEnumerableReadOnlyAccessor", "setNonEnumerableReadWriteAccessor", "setReadOnlyAccessor", "setReadWriteAccessor", "getter", "setter", "createPrototypeAccessors", "p", "fields", "get", "set", "out", "o", "i", "require_field_properties", "__commonJSMin", "exports", "module", "FIELD_PROPERTIES", "require_is_union_type", "__commonJSMin", "exports", "module", "isCollection", "isUnionType", "obj", "require_has_properties", "__commonJSMin", "exports", "module", "hasProp", "hasProperties", "obj", "keys", "i", "require_is_valid_nonempty_string", "__commonJSMin", "exports", "module", "isString", "format", "isValidNonEmptyString", "value", "name", "require_is_valid_string", "__commonJSMin", "exports", "module", "isString", "format", "isValidString", "value", "name", "require_is_valid_positive_integer", "__commonJSMin", "exports", "module", "isPositiveInteger", "format", "isValidPositiveInteger", "value", "name", "require_is_valid_boolean", "__commonJSMin", "exports", "module", "isBoolean", "format", "isValidBoolean", "value", "name", "require_dtypes", "__commonJSMin", "exports", "module", "DTYPES", "require_is_valid_type", "__commonJSMin", "exports", "module", "isStructConstructorLike", "contains", "join", "format", "DTYPES", "isValidType", "value", "require_is_valid_one_of", "__commonJSMin", "exports", "module", "contains", "join", "format", "isValidOneOf", "values", "isValid", "value", "name", "require_init_field_object", "__commonJSMin", "exports", "module", "initFieldObject", "require_byte_length", "__commonJSMin", "exports", "module", "bytesPerElement", "byteLength", "obj", "nb", "require_casting_modes", "__commonJSMin", "exports", "module", "CASTING_MODES", "require_alignments", "__commonJSMin", "exports", "module", "ALIGNMENTS", "require_normalize_field", "__commonJSMin", "exports", "module", "isStructConstructorLike", "hasProp", "join", "constantFunction", "format", "hasProperties", "isValidNonEmptyString", "isValidString", "isValidPositiveInteger", "isValidBoolean", "isValidType", "isValidOneOf", "initFieldObject", "byteLength", "CASTING_MODES", "ALIGNMENTS", "MANDATORY_FIELD_NAMES", "VALIDATORS", "normalize", "obj", "keys", "out", "err", "v", "k", "i", "require_resolve_alignment", "__commonJSMin", "exports", "module", "alignment", "fields", "max", "v", "i", "require_normalize_union", "__commonJSMin", "exports", "module", "isObject", "hasProp", "format", "isUnionType", "FIELD_PROPERTIES", "normalizeField", "resolveAlignment", "normalizeUnion", "obj", "fields", "dflg", "out", "tmp", "len", "o", "i", "require_normalize_field_list", "__commonJSMin", "exports", "module", "isObject", "format", "FIELD_PROPERTIES", "isUnionType", "normalizeField", "normalizeUnion", "normalize", "fields", "out", "tmp", "o", "i", "require_field_names", "__commonJSMin", "exports", "module", "format", "isUnionType", "fieldNames", "fields", "hash", "out", "o1", "o2", "i", "j", "k", "require_field_index", "__commonJSMin", "exports", "module", "indexOf", "join", "format", "fieldIndex", "names", "name", "idx", "require_byte_offsets", "__commonJSMin", "exports", "module", "min", "isUnionType", "setPadding", "fields", "padding", "i", "byteOffsets", "max", "alignment", "offset", "tmp", "o", "j", "require_partitions", "__commonJSMin", "exports", "module", "partitions", "fields", "out", "N", "o", "i", "j", "require_flatten_fields", "__commonJSMin", "exports", "module", "isUnionType", "flatten", "fields", "out", "o", "i", "j", "require_format_linear", "__commonJSMin", "exports", "module", "floor", "format", "linearFormat", "Struct", "fields", "nbytes", "fmt0", "fmt1", "fmt2", "bfmt", "ufmt", "fmt", "tmp", "out", "flg", "ib", "c0", "c1", "c2", "w0", "w1", "w", "N", "o", "f", "t", "i", "j", "k", "require_format_layout", "__commonJSMin", "exports", "module", "replace", "format", "reByteOffset", "replacer", "offset", "wrapped", "match", "p1", "layoutFormat", "fields", "out", "tmp", "re", "N", "o", "i", "require_to_string", "__commonJSMin", "exports", "module", "isPlainObject", "hasOwnProp", "contains", "join", "format", "linearFormat", "layoutFormat", "FORMATS", "isFormat", "toString", "Struct", "fields", "options", "opts", "require_to_json", "__commonJSMin", "exports", "module", "isCollection", "isComplexLike", "isFunction", "typedarray2json", "isStructInstance", "toJSON", "struct", "fields", "out", "o", "v", "i", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "setNonEnumerableReadOnlyAccessor", "isStructConstructorLike", "isNonNegativeInteger", "isCollection", "isArrayBuffer", "isObject", "hasProp", "min", "filled", "ArrayBuffer", "DataView", "format", "PRIVATE_BUFFER", "CTOR_NAME", "createPrototypeAccessors", "isStructInstance", "normalize", "fieldNames", "fieldIndex", "resolveAlignment", "byteOffsets", "partitions", "flatten", "struct2string", "struct2json", "layoutFormat", "factory", "fields", "FIELD_NAMES", "BYTE_LENGTH", "PARTITIONS", "ALIGNMENT", "ACCESSORS", "FIELDS", "tmp", "o", "Struct", "arg", "byteOffset", "byteLength", "values", "nargs", "cache", "view", "obj", "v", "i", "j", "k", "name", "idx", "value", "buf", "opts", "main"] -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index f4faea6..0000000 --- a/examples/index.js +++ /dev/null @@ -1,140 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 Float64Array = require( '@stdlib/array-float64' ); -var factory = require( './../lib' ); - -var fields = [ - { - 'name': 'rejected', - 'description': 'boolean indicating whether the null hypothesis was rejected', - 'type': 'bool', - 'enumerable': true, - 'writable': false, - 'castingMode': 'none' - }, - { - 'name': 'alpha', - 'description': 'significance level', - 'type': 'float64', - 'enumerable': true, - 'writable': false, - 'castingMode': 'mostly-safe' - }, - { - 'name': 'pValue', - 'description': 'p-value', - 'type': 'float64', - 'enumerable': true, - 'writable': false, - 'castingMode': 'mostly-safe' - }, - { - 'name': 'statistic', - 'description': 'test statistic', - 'type': 'float64', - 'writable': false, - 'castingMode': 'mostly-safe' - }, - { - 'name': 'ci', - 'description': 'confidence interval', - 'type': 'float64', - 'length': 2, - 'enumerable': true, - 'writable': false, - 'castingMode': 'mostly-safe' - }, - { - 'name': 'df', - 'description': 'degrees of freedom', - 'type': 'int32', - 'enumerable': true, - 'writable': false, - 'castingMode': 'mostly-safe' - }, - { - 'name': 'nullValue', - 'description': 'null value', - 'type': 'float64', - 'enumerable': true, - 'writable': false, - 'castingMode': 'mostly-safe' - }, - { - 'name': 'mean', - 'description': 'computed mean', - 'type': 'float64', - 'enumerable': true, - 'writable': false, - 'castingMode': 'mostly-safe' - }, - { - 'name': 'sd', - 'description': 'standard error of the mean', - 'type': 'float64', - 'enumerable': true, - 'writable': false, - 'castingMode': 'mostly-safe' - } -]; - -var Struct = factory( fields ); - -var s = new Struct({ - 'rejected': true, - 'alpha': 0.05, - 'pValue': 0.01, - 'statistic': 3.14, - 'ci': new Float64Array( [ -5.0, 5.0 ] ), - 'df': 10, - 'nullValue': 1.0, - 'mean': 1.01, - 'sd': 0.025 -}); -// returns - -var byteLength = Struct.byteLength; -console.log( 'Byte length: %d', byteLength ); - -var alignment = Struct.alignment; -console.log( 'Alignment: %d', alignment ); - -var names = Struct.fields; -console.log( 'Field names: %s', names.join( ', ' ) ); - -var str1 = s.toString({ - 'format': 'linear' -}); -console.log( 'String:\n%s', str1 ); - -var str2 = s.toString({ - 'format': 'layout' -}); -console.log( 'Layout: %s', str2 ); - -var o = s.toJSON(); -console.log( o ); - -var offset = Struct.byteOffsetOf( 'alpha' ); -console.log( 'Offset: %d', offset ); - -var desc = Struct.descriptionOf( 'alpha' ); -console.log( 'Description: %s', desc ); diff --git a/examples/nested_struct.js b/examples/nested_struct.js deleted file mode 100644 index 1131e33..0000000 --- a/examples/nested_struct.js +++ /dev/null @@ -1,89 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 factory = require( './../lib' ); - -var fields1 = [ - { - 'name': 'high', - 'description': 'high word', - 'type': 'uint32', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - }, - { - 'name': 'low', - 'description': 'low word', - 'type': 'uint32', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - } -]; -var Struct1 = factory( fields1 ); - -var fields2 = [ - { - 'name': 'double', - 'description': 'double-precision floating-point number', - 'type': 'float64', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - }, - { - 'name': 'words', - 'description': 'high and low words', - 'type': Struct1, - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - } -]; -var Struct2 = factory( fields2 ); - -var s = new Struct2(); -// returns - -var byteLength = Struct2.byteLength; -console.log( 'Byte length: %d', byteLength ); - -var alignment = Struct2.alignment; -console.log( 'Alignment: %d', alignment ); - -var names = Struct2.fields; -console.log( 'Field names: %s', names.join( ', ' ) ); - -var str1 = s.toString({ - 'format': 'layout' -}); -console.log( 'String:\n%s', str1 ); - -var str2 = s.toString({ - 'format': 'layout' -}); -console.log( 'Layout: %s', str2 ); - -var o = s.toJSON(); -console.log( o ); - -var offset = Struct2.byteOffsetOf( 'double' ); -console.log( 'Offset: %d', offset ); diff --git a/examples/union.js b/examples/union.js deleted file mode 100644 index 09b192b..0000000 --- a/examples/union.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 toWords = require( '@stdlib/number-float64-base-to-words' ); -var factory = require( './../lib' ); - -var fields = [ - { - 'type': 'union', - 'fields': [ - { - 'name': 'double', - 'description': 'double-precision floating-point number', - 'type': 'float64', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - }, - { - 'name': 'words', - 'description': 'high and low words', - 'type': 'uint32', - 'length': 2, - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - } - ] - } -]; - -var Struct = factory( fields ); - -var s = new Struct({ - 'double': 3.14 -}); -// returns - -var byteLength = Struct.byteLength; -console.log( 'Byte length: %d', byteLength ); - -var alignment = Struct.alignment; -console.log( 'Alignment: %d', alignment ); - -var names = Struct.fields; -console.log( 'Field names: %s', names.join( ', ' ) ); - -var str1 = s.toString({ - 'format': 'linear' -}); -console.log( 'String:\n%s', str1 ); - -var str2 = s.toString({ - 'format': 'layout' -}); -console.log( 'Layout: %s', str2 ); - -var o = s.toJSON(); -console.log( o ); - -var offset = Struct.byteOffsetOf( 'double' ); -console.log( 'Offset: %d', offset ); - -var words1 = s.words; -console.log( 'Words: [%s]', words1.join( ', ' ) ); - -var words2 = toWords( 3.14 ); -console.log( 'Words: [%s]', words2.join( ', ' ) ); diff --git a/examples/union_with_complex.js b/examples/union_with_complex.js deleted file mode 100644 index bde0d0b..0000000 --- a/examples/union_with_complex.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 Complex128 = require( '@stdlib/complex-float64-ctor' ); -var factory = require( './../lib' ); - -var fields = [ - { - 'type': 'union', - 'fields': [ - { - 'name': 'z', - 'description': 'double-precision complex floating-point number', - 'type': 'complex128', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - }, - { - 'name': 'components', - 'description': 'real and imaginary components', - 'type': 'float64', - 'length': 2, - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - } - ] - } -]; - -var Struct = factory( fields ); - -var s = new Struct({ - 'z': new Complex128( 3.0, 5.0 ) -}); -// returns - -var byteLength = Struct.byteLength; -console.log( 'Byte length: %d', byteLength ); - -var alignment = Struct.alignment; -console.log( 'Alignment: %d', alignment ); - -var names = Struct.fields; -console.log( 'Field names: %s', names.join( ', ' ) ); - -var str1 = s.toString({ - 'format': 'linear' -}); -console.log( 'String:\n%s', str1 ); - -var str2 = s.toString({ - 'format': 'layout' -}); -console.log( 'Layout: %s', str2 ); - -var o = s.toJSON(); -console.log( o ); - -s.components[ 0 ] = -3.14; -o = s.toJSON(); -console.log( o ); diff --git a/examples/union_with_struct.js b/examples/union_with_struct.js deleted file mode 100644 index 488c7d5..0000000 --- a/examples/union_with_struct.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var toWords = require( '@stdlib/number-float64-base-to-words' ); -var factory = require( './../lib' ); - -var fields1 = [ - { - 'name': ( IS_LITTLE_ENDIAN ) ? 'low' : 'high', - 'description': 'word', - 'type': 'uint32', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - }, - { - 'name': ( IS_LITTLE_ENDIAN ) ? 'high' : 'low', - 'description': 'word', - 'type': 'uint32', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - } -]; -var Struct1 = factory( fields1 ); - -var fields2 = [ - { - 'type': 'union', - 'fields': [ - { - 'name': 'double', - 'description': 'double-precision floating-point number', - 'type': 'float64', - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - }, - { - 'name': 'words', - 'description': 'high and low words', - 'type': Struct1, - 'enumerable': true, - 'writable': true, - 'castingMode': 'none' - } - ] - } -]; -var Struct2 = factory( fields2 ); - -var s = new Struct2({ - 'double': 3.14 -}); -// returns - -var byteLength = Struct2.byteLength; -console.log( 'Byte length: %d', byteLength ); - -var alignment = Struct2.alignment; -console.log( 'Alignment: %d', alignment ); - -var names = Struct2.fields; -console.log( 'Field names: %s', names.join( ', ' ) ); - -var str1 = s.toString({ - 'format': 'linear' -}); -console.log( 'String:\n%s', str1 ); - -var str2 = s.toString({ - 'format': 'layout' -}); -console.log( 'Layout: %s', str2 ); - -var o = s.toJSON(); -console.log( o ); - -var offset = Struct2.byteOffsetOf( 'double' ); -console.log( 'Offset: %d', offset ); - -var words1 = s.words; -console.log( 'Words: [%d, %d]', words1.high, words1.low ); - -var words2 = toWords( 3.14 ); -console.log( 'Words: [%s]', words2.join( ', ' ) ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..400e42f --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-accessor@v0.2.4-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-struct-constructor-like@v0.1.1-esm/index.mjs";import{isPrimitive as s}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-nonnegative-integer@v0.2.3-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-collection@v0.2.3-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-arraybuffer@v0.2.3-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-object@v0.2.3-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-property@v0.2.3-esm/index.mjs";import l from"https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-fast-min@v0.3.1-esm/index.mjs";import f from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled@v0.2.3-esm/index.mjs";import d from"https://cdn.jsdelivr.net/gh/stdlib-js/array-buffer@v0.2.3-esm/index.mjs";import m from"https://cdn.jsdelivr.net/gh/stdlib-js/array-dataview@v0.2.3-esm/index.mjs";import u from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";import p from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-write-accessor@v0.2.3-esm/index.mjs";import c from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-read-only-accessor@v0.2.3-esm/index.mjs";import g from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-read-write-accessor@v0.2.3-esm/index.mjs";import h from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-little-endian@esm/index.mjs";import y from"https://cdn.jsdelivr.net/gh/stdlib-js/boolean-ctor@esm/index.mjs";import b from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-cmplx@esm/index.mjs";import v from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed@esm/index.mjs";import j from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-real-floating-point-data-type@esm/index.mjs";import w from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-signed-integer-data-type@esm/index.mjs";import{isPrimitive as x}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-number@esm/index.mjs";import{isPrimitive as O}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-boolean@esm/index.mjs";import{isPrimitive as E}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-integer@esm/index.mjs";import{isPrimitive as T}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-bigint@esm/index.mjs";import S from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-complex-like@esm/index.mjs";import L from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-assert-is-allowed-data-type-cast@esm/index.mjs";import V from"https://cdn.jsdelivr.net/gh/stdlib-js/array-min-dtype@esm/index.mjs";import F from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-min-signed-integer-dtype@esm/index.mjs";import U from"https://cdn.jsdelivr.net/gh/stdlib-js/complex-dtype@esm/index.mjs";import I from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";import J from"https://cdn.jsdelivr.net/gh/stdlib-js/number-ctor@esm/index.mjs";import N from"https://cdn.jsdelivr.net/gh/stdlib-js/bigint-ctor@esm/index.mjs";import k from"https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-floor@esm/index.mjs";import M from"https://cdn.jsdelivr.net/gh/stdlib-js/array-uint8@esm/index.mjs";import _ from"https://cdn.jsdelivr.net/gh/stdlib-js/blas-base-gcopy@esm/index.mjs";import A from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-dataview@v0.2.3-esm/index.mjs";import P from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@esm/index.mjs";import B from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@esm/index.mjs";import R from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-real-data-type@esm/index.mjs";import D from"https://cdn.jsdelivr.net/gh/stdlib-js/array-dtype@esm/index.mjs";import $ from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@esm/index.mjs";import z from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@esm/index.mjs";import q from"https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill@esm/index.mjs";import C from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map@esm/index.mjs";import G from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-join@v0.1.2-esm/index.mjs";import H from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-constant-function@v0.2.3-esm/index.mjs";import{isPrimitive as K}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import{isPrimitive as Q}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import{isPrimitive as W}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-positive-integer@v0.2.3-esm/index.mjs";import{isPrimitive as X}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-boolean@v0.2.3-esm/index.mjs";import Y,{factory as Z}from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-contains@v0.2.3-esm/index.mjs";import tt from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-join@esm/index.mjs";import et from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-contains@esm/index.mjs";import nt from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-bytes-per-element@esm/index.mjs";import st from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-object@esm/index.mjs";import rt from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-index-of@v0.3.1-esm/index.mjs";import it from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-plain-object@v0.2.3-esm/index.mjs";import at from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.3-esm/index.mjs";import ot from"https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-floor@v0.2.4-esm/index.mjs";import lt from"https://cdn.jsdelivr.net/gh/stdlib-js/string-base-replace@v0.2.3-esm/index.mjs";import ft from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-complex-like@v0.2.4-esm/index.mjs";import dt from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.3-esm/index.mjs";import mt from"https://cdn.jsdelivr.net/gh/stdlib-js/array-to-json@v0.3.1-esm/index.mjs";var ut="__@@##$$@@__struct_buffer__@@$$##@@__",pt={int8:{get:"getInt8",set:"setInt8"},int16:{get:"getInt16",set:"setInt16"},int32:{get:"getInt32",set:"setInt32"},int64:{get:"getBigInt64",set:"setBigInt64"},uint8:{get:"getUint8",set:"setUint8"},uint16:{get:"getUint16",set:"setUint16"},uint32:{get:"getUint32",set:"setUint32"},uint64:{get:"getBigUint64",set:"setBigUint64"},float16:{get:"getFloat16",set:"setFloat16"},float32:{get:"getFloat32",set:"setFloat32"},float64:{get:"getFloat64",set:"setFloat64"},complex32:{get:"getFloat16",set:"setFloat16"},complex64:{get:"getFloat32",set:"setFloat32"},complex128:{get:"getFloat64",set:"setFloat64"},bool:{get:"getUint8",set:"setUint8"}};var ct={complex128:"float64",complex64:"float32",complex32:"float16"};function gt(t){if(t.length)return t.isStructType?function(t){return function(){var e,n,s,r;for(e=(n=this[ut]).byteOffset+t.byteOffset,s=[],r=0;r0?null:new TypeError(u("invalid argument. `%s` field must be a non-empty string. Value: `%s`.",e,t))},type:function(t){return Y(Ft,t)||n(t)?null:new TypeError(I('invalid argument. `%s` field must be either a struct type or one of the following: "%s". Value: `%s`.',"type",tt(Ft,", "),t))},description:function(t,e){return Q(t)?null:new TypeError(u("invalid argument. `%s` field must be a string. Value: `%s`.",e,t))},length:function(t,e){return W(t)?null:new TypeError(u("invalid argument. `%s` field must be a positive integer. Value: `%s`.",e,t))},enumerable:Vt,writable:Vt,default:H(null),castingMode:(Ut=["none","safe","mostly-safe","same-kind","unsafe"],function(t,e){return et(Ut,t)?null:new TypeError(I('invalid argument. `%s` field must be one of the following: "%s". Value: `%s`.',e,tt(Ut,", "),t))})};function kt(t,e){var s,r,i,a,l;for(s={isStructType:!1,description:"",byteLength:0,byteOffset:0,alignment:0,padding:0,enumerable:!0,writable:!0,default:void 0,castingMode:"none"},l=0;le&&(e=n);return e}function _t(t){var e,n,s,r,i,a,l;if(0===(e=t.fields).length)return null;for(s=[],l=0;l0&&i.byteOffset===t[a-1].byteOffset||(i.isStructType?e.push(lt(i.type.layout,s,Bt(i.byteOffset))):e.push(u("|<%s>[%u,%u]",i.type,i.byteOffset,i.byteLength)));return"|"===(n=u("%s|",e.join("")))[n.length-2]&&(n=n.substring(0,n.length-1)),n}var Dt=["none","linear","layout"],$t=Z(Dt);function zt(t,e,n){var s;if(!it(n))throw new TypeError(u("null2V",n));if(s={format:"none"},at(n,"format")&&(s.format=n.format,!$t(s.format)))throw new TypeError(u("null4S","format",G(Dt,", "),n.format));return"linear"===s.format?function(t,e){var n,s,r,i,a,o,l,f,d,m,p,c,g,h,y,b,v,j,w,x,O,E;for(b=e.length,n="%"+(t.byteLength-1).toString().length+"s",h=0,x=0;xh&&(h=y);for(s="%"+h+"s",r="// %s",o="%s: %s %s",m=0,f=[],x=0;x0&&v.byteOffset===e[x-1].byteOffset)){for(d=x1?" (byte %u)":"",d){for(a=" => union: %s",l=[],E=x+1;E":j.type,l.push(u("%s<%s>[%u]",j.name,w,O%j.alignment)),E+=1;a=u(a,l.join(", "))}else a="";l=u(i+a,O%v.alignment),g=v.length?u(r,u("%s[%u]%s",v.type,ot(O/v.alignment),l)):u(r,u("%s%s",v.type,l)),f.push(u(o,p,c,g)),m+=1}for(O=0;O"}function qt(h){var y,b,v,j,w,x,O,E;if(!r(h))throw new TypeError(u("null2O",h));if(O=function(t){var e,n,s,r;for(e=[],r=0;r0){if(!a(e))throw new TypeError(u("null3L",e));j=e}if(t(this,ut,h),void 0!==j){for(p=f(void 0,x.length),g={},S=0;S0&&((i=t[o-1]).padding=s,Lt(a)&&Pt(i.fields,s)),a.byteOffset=r,Lt(a))for(f=0;f0?arguments[0]:{})})),t(T.prototype,"toJSON",(function(){if(!(this instanceof T))throw new Error("invalid invocation. `this` is not a struct instance.");return function(t,e){var n,s,i,a;for(n={},a=0;a} result\n\t*/\n\tfunction getter() {\n\t\tvar offset;\n\t\tvar view;\n\t\tvar out;\n\t\tvar i;\n\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\toffset = view.byteOffset + obj.byteOffset;\n\t\tout = [];\n\t\tfor ( i = 0; i < obj.length; i++ ) {\n\t\t\tout.push( new obj.type( view.buffer, offset, obj.byteLength ) );\n\t\t\toffset += obj.byteOffset;\n\t\t}\n\t\treturn out;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default getStructArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport typedarray from '@stdlib/array-typed';\nimport PRIVATE_BUFFER from './private_buffer.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for resolving field data\n*/\nfunction getTypedArray( obj ) {\n\treturn getter;\n\n\t/**\n\t* Returns a typed array view of an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {TypedArray} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn typedarray( view.buffer, view.byteOffset+obj.byteOffset, obj.length, obj.type ); // eslint-disable-line max-len\n\t}\n}\n\n\n// EXPORTS //\n\nexport default getTypedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport PRIVATE_BUFFER from './private_buffer.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for resolving field data\n*/\nfunction getBigInt( obj, method ) {\n\treturn getter;\n\n\t/**\n\t* Reads a BigInt value from an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {BigInt} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default getBigInt;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport Boolean from '@stdlib/boolean-ctor';\nimport PRIVATE_BUFFER from './private_buffer.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for resolving field data\n*/\nfunction getBoolean( obj, method ) {\n\treturn getter;\n\n\t/**\n\t* Reads a boolean value from an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {boolean} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn Boolean( view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN ) );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default getBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport PRIVATE_BUFFER from './private_buffer.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for resolving field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for resolving field data\n*/\nfunction getStruct( obj ) {\n\treturn getter;\n\n\t/**\n\t* Returns a `struct` view of an underlying byte buffer.\n\t*\n\t* @private\n\t* @returns {Object} result\n\t*/\n\tfunction getter() {\n\t\tvar view = this[ PRIVATE_BUFFER ];\n\t\treturn new obj.type( view.buffer, view.byteOffset+obj.byteOffset, obj.byteLength ); // eslint-disable-line max-len\n\t}\n}\n\n\n// EXPORTS //\n\nexport default getStruct;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Converts a boolean to a number.\n*\n* @private\n* @param {boolean} value - input value\n* @returns {number} result\n*/\nfunction boolean2number( value ) {\n\treturn ( value ) ? 1 : 0;\n}\n\n\n// EXPORTS //\n\nexport default boolean2number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n/**\n* Converts a BigInt to a number.\n*\n* @private\n* @param {BigInt} value - input value\n* @returns {number} result\n*/\nfunction bigint2number( value ) {\n\treturn Number( value );\n}\n\n\n// EXPORTS //\n\nexport default bigint2number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Converts a number to a boolean.\n*\n* @private\n* @param {number} value - input value\n* @returns {boolean} result\n*/\nfunction number2boolean( value ) {\n\treturn Boolean( value );\n}\n\n\n// EXPORTS //\n\nexport default number2boolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Converts a complex number to a boolean.\n*\n* @private\n* @param {ComplexLike} value - input value\n* @returns {boolean} result\n*/\nfunction complex2boolean( value ) {\n\treturn Boolean( value.re || value.im );\n}\n\n\n// EXPORTS //\n\nexport default complex2boolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isBigInt } from '@stdlib/assert-is-bigint';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isAllowedCast from '@stdlib/ndarray-base-assert-is-allowed-data-type-cast';\nimport complexDType from '@stdlib/complex-dtype';\nimport Boolean from '@stdlib/boolean-ctor';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport PRIVATE_BUFFER from './private_buffer.js';\nimport boolean2number from './boolean2number.js';\nimport number2boolean from './number2boolean.js';\nimport complex2boolean from './complex2boolean.js';\nimport bigint2boolean from './bigint2boolean.js';\nimport defaults from './defaults.json';\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setBoolean( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a boolean value to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar v;\n\t\tif ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tv = boolean2number( value );\n\t\t} else if ( isNumber( value ) ) {\n\t\t\tdt = defaults.dtypes.real;\n\t\t\tv = boolean2number( number2boolean( value ) );\n\t\t} else if ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here\n\t\t\tv = boolean2number( bigint2boolean( value ) );\n\t\t} else if ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || defaults.dtypes.complex;\n\t\t\tv = boolean2number( complex2boolean( value ) );\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tv = Boolean( value );\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Converts a BigInt to a boolean.\n*\n* @private\n* @param {BigInt} value - input value\n* @returns {boolean} result\n*/\nfunction bigint2boolean( value ) {\n\treturn Boolean( value );\n}\n\n\n// EXPORTS //\n\nexport default bigint2boolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport { isPrimitive as isBigInt } from '@stdlib/assert-is-bigint';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isAllowedCast from '@stdlib/ndarray-base-assert-is-allowed-data-type-cast';\nimport minDataType from '@stdlib/array-min-dtype';\nimport complexDType from '@stdlib/complex-dtype';\nimport BigInt from '@stdlib/bigint-ctor';\nimport Number from '@stdlib/number-ctor';\nimport floor from '@stdlib/math-base-special-floor';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport PRIVATE_BUFFER from './private_buffer.js';\nimport boolean2bigint from './boolean2bigint.js';\nimport defaults from './defaults.json';\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setBigInt( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a number value to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar v;\n\t\tif ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // FIXME: support both int64 and uint64\n\t\t\tv = value;\n\t\t} else if ( isNumber( value ) ) {\n\t\t\tif ( isInteger( value ) ) {\n\t\t\t\tdt = minDataType( value );\n\t\t\t\tv = BigInt( value );\n\t\t\t} else {\n\t\t\t\tdt = defaults.dtypes.real;\n\t\t\t\tv = BigInt( floor( value ) );\n\t\t\t}\n\t\t} else if ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tv = boolean2bigint( value );\n\t\t} else if ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || defaults.dtypes.complex;\n\t\t\tv = BigInt( floor( value.re ) ); // discard imaginary component\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tv = BigInt( floor( Number( v ) ) );\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setBigInt;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 BigInt from '@stdlib/bigint-ctor';\n\n\n// MAIN //\n\n/**\n* Converts a boolean to a BigInt.\n*\n* @private\n* @param {boolean} value - input value\n* @returns {number} result\n*/\nfunction boolean2bigint( value ) {\n\treturn BigInt( ( value ) ? 1 : 0 );\n}\n\n\n// EXPORTS //\n\nexport default boolean2bigint;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isDataView from '@stdlib/assert-is-dataview';\nimport isObject from '@stdlib/assert-is-object';\nimport PRIVATE_BUFFER from './private_buffer.js';\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `struct` instance.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `struct` instance\n*/\nfunction isStructInstance( value ) {\n\t// NOTE: the following is a relatively weak test, but we cannot use `instanceof` checks, etc, due to the factory nature of the implementation. Regardless, here, we are just trying to sniff out a `struct` type. If calling as a constructor later fails, we punt the responsibility off to the user to handle what should be an edge case. If, in the future, this check proves insufficient, we can add further \"brand\" checks...\n\treturn (\n\t\tisObject( value ) &&\n\t\tisDataView( value[ PRIVATE_BUFFER ] )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isStructInstance;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Converts a complex number to a number.\n*\n* @private\n* @param {ComplexLike} value - input value\n* @returns {number} result\n*/\nfunction complex2number( value ) {\n\treturn value.re;\n}\n\n\n// EXPORTS //\n\nexport default complex2number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 format from '@stdlib/error-tools-fmtprodmsg';\nimport DATA_VIEW_METHODS from './data_view_methods.js';\nimport setNumber from './set_number.js';\nimport setComplex from './set_complex.js';\nimport setBoolean from './set_boolean.js';\nimport setBigInt from './set_bigint.js';\nimport setStruct from './set_struct.js';\nimport setTypedArray from './set_typedarray.js';\nimport setStructArray from './set_struct_array.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for setting field data.\n*\n* @private\n* @param {Object} obj - field object\n* @throws {Error} unexpected error\n* @returns {Function} function for setting field data\n*/\nfunction setter( obj ) {\n\tif ( obj.length ) {\n\t\tif ( obj.isStructType ) {\n\t\t\treturn setStructArray( obj );\n\t\t}\n\t\treturn setTypedArray( obj );\n\t}\n\tswitch ( obj.type ) {\n\tcase 'float64':\n\tcase 'float32':\n\tcase 'float16':\n\tcase 'int8':\n\tcase 'int16':\n\tcase 'int32':\n\tcase 'uint8':\n\tcase 'uint16':\n\tcase 'uint32':\n\t\treturn setNumber( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tcase 'int64':\n\tcase 'uint64':\n\t\treturn setBigInt( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tcase 'bool':\n\t\treturn setBoolean( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tcase 'complex128':\n\tcase 'complex64':\n\tcase 'complex32':\n\t\treturn setComplex( obj, DATA_VIEW_METHODS[ obj.type ].set );\n\n\tdefault:\n\t\tif ( obj.isStructType ) {\n\t\t\treturn setStruct( obj );\n\t\t}\n\t\t// Ensure that we fail loudly if we have failed to add support for newly added data types:\n\t\tthrow new Error( format( 'unexpected error. Unrecognized data type. Value: `%s`.', obj.type ) );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setter;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport isCollection from '@stdlib/assert-is-collection';\nimport Uint8Array from '@stdlib/array-uint8';\nimport gcopy from '@stdlib/blas-base-gcopy';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport PRIVATE_BUFFER from './private_buffer.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for writing field data\n*/\nfunction setStructArray( obj ) {\n\treturn setter;\n\n\t/**\n\t* Writes a list of `struct` instances to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {Collection} values - list of `struct` instances\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {RangeError} must provide an array-like object having an expected length\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( values ) {\n\t\tvar offset;\n\t\tvar views;\n\t\tvar view;\n\t\tvar dest;\n\t\tvar src;\n\t\tvar buf;\n\t\tvar nb;\n\t\tvar i;\n\n\t\tif ( !isCollection( values ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', obj.name, values ) );\n\t\t}\n\t\tif ( values.length !== obj.length ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be an array-like object having length %u.', obj.name, obj.length ) );\n\t\t}\n\t\tif ( obj.casting === 'none' ) {\n\t\t\tfor ( i = 0; i < values.length; i++ ) {\n\t\t\t\tif ( !( values[ i ] instanceof obj.type ) ) { // note: this check will fail for cross-realm `struct` instances\n\t\t\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Value: `%s`.', obj.name, values[ i ] ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Compute the expected number of bytes per struct view:\n\t\tnb = obj.byteLength / obj.length; // note: as a field is expected to have a homogeneous data type, the byte length should be evenly divisible by the number of elements\n\n\t\t// Check that all struct instances have the same byte length...\n\t\tviews = [];\n\t\tfor ( i = 0; i < values.length; i++ ) {\n\t\t\tbuf = this.constructor.viewOf( values[ i ] );\n\t\t\tif ( buf.byteLength !== nb ) {\n\t\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be an array-like object containing `struct` instances having the same byte length.', obj.name ) );\n\t\t\t}\n\t\t\tsrc = new Uint8Array( buf.buffer, buf.byteOffset, nb );\n\t\t\tviews.push( src );\n\t\t}\n\t\t// Write the data for each `struct` to the underlying byte buffer...\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\toffset = view.byteOffset + obj.byteOffset;\n\t\tfor ( i = 0; i < values.length; i++ ) {\n\t\t\tdest = new Uint8Array( view.buffer, offset, nb );\n\t\t\tgcopy( obj.length, views[ i ], 1, dest, 1 );\n\t\t\toffset += nb;\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setStructArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport isCollection from '@stdlib/assert-is-collection';\nimport isAllowedCast from '@stdlib/ndarray-base-assert-is-allowed-data-type-cast';\nimport isComplexDataType from '@stdlib/array-base-assert-is-complex-floating-point-data-type';\nimport isBooleanDataType from '@stdlib/array-base-assert-is-boolean-data-type';\nimport isRealDataType from '@stdlib/array-base-assert-is-real-data-type';\nimport typedarray from '@stdlib/array-typed';\nimport dtype from '@stdlib/array-dtype';\nimport reinterpretComplex from '@stdlib/strided-base-reinterpret-complex';\nimport reinterpretBoolean from '@stdlib/strided-base-reinterpret-boolean';\nimport gcopy from '@stdlib/blas-base-gcopy';\nimport gfill from '@stdlib/blas-ext-base-gfill';\nimport map from '@stdlib/array-base-map';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport PRIVATE_BUFFER from './private_buffer.js';\nimport isStructInstance from './is_struct_instance.js';\nimport number2boolean from './number2boolean.js';\nimport complex2boolean from './complex2boolean.js';\nimport complex2number from './complex2number.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for writing field data\n*/\nfunction setTypedArray( obj ) {\n\treturn setter;\n\n\t/**\n\t* Writes a list of values to a typed array view of an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {Collection} value - value to set\n\t* @throws {TypeError} must provide an array-like object\n\t* @throws {RangeError} must provide an array-like object having an expected length\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar buf;\n\t\tvar dt;\n\t\tif ( !isCollection( value ) || isStructInstance( value ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', obj.name, value ) );\n\t\t}\n\t\tif ( value.length !== obj.length ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be an array-like object having length %u.', obj.name, obj.length ) );\n\t\t}\n\t\tdt = dtype( value );\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tbuf = this[ PRIVATE_BUFFER ];\n\t\tview = typedarray( buf.buffer, buf.byteOffset+obj.byteOffset, obj.length, obj.type );\n\t\tif ( dt === obj.type ) {\n\t\t\t// Case: complex => complex\n\t\t\tif ( isComplexDataType( dt ) ) {\n\t\t\t\tgcopy( obj.length*2, reinterpretComplex( value, 0 ), 1, reinterpretComplex( view, 0 ), 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: boolean => boolean\n\t\t\tif ( isBooleanDataType( dt ) ) {\n\t\t\t\tgcopy( obj.length, reinterpretBoolean( value, 0 ), 1, reinterpretBoolean( view, 0 ), 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: real => real\n\t\t\tgcopy( obj.length, value, 1, view, 1 );\n\t\t\treturn;\n\t\t}\n\t\t// Case: real => ???\n\t\tif ( isRealDataType( dt ) ) {\n\t\t\t// Case: real => real\n\t\t\tif ( isRealDataType( obj.type ) ) {\n\t\t\t\tgcopy( obj.length, value, 1, view, 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: real => complex\n\t\t\tif ( isComplexDataType( obj.type ) ) {\n\t\t\t\tview = reinterpretComplex( view, 0 );\n\n\t\t\t\t// TODO: consider refactoring to avoid two-passes; may require creating a separate strided utility explicitly aimed at casting real-valued arrays to complex arrays\n\t\t\t\tgcopy( obj.length, view, 2, value, 1 ); // assign to only real-components\n\t\t\t\tgfill.ndarray( obj.length, 0.0, view, 2, 1 ); // fill imaginary components with zeros\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: real => boolean\n\t\t\tmap.assign( value, view, 1, 0, number2boolean );\n\t\t\treturn;\n\t\t}\n\t\t// Case: complex => ???\n\t\tif ( isComplexDataType( dt ) ) {\n\t\t\t// Case: complex => real\n\t\t\tif ( isRealDataType( obj.type ) ) {\n\t\t\t\tmap.assign( value, view, 1, 0, complex2number ); // discard imaginary components\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: complex => complex\n\t\t\tif ( isComplexDataType( obj.type ) ) {\n\t\t\t\tgcopy( obj.length*2, reinterpretComplex( value, 0 ), 1, reinterpretComplex( view, 0 ), 1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Case: complex => boolean\n\t\t\tmap.assign( value, view, 1, 0, complex2boolean );\n\t\t\treturn;\n\t\t}\n\t\t// Case: boolean => ???\n\n\t\t// Case: boolean => real\n\t\tif ( isRealDataType( obj.type ) ) {\n\t\t\tgcopy( obj.length, reinterpretBoolean( value, 0 ), 1, view, 1 );\n\t\t\treturn;\n\t\t}\n\t\t// Case: boolean => complex\n\t\tview = reinterpretComplex( view, 0 );\n\n\t\t// TODO: consider refactoring to avoid two-passes; may require creating a separate strided utility explicitly aimed at casting real-valued arrays to complex arrays\n\t\tgcopy( obj.length, view, 2, reinterpretBoolean( value, 0 ), 1 ); // assign to only real-components\n\t\tgfill.ndarray( obj.length, 0.0, view, 2, 1 ); // fill imaginary components with zeros\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setTypedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport isRealFloatingPointDataType from '@stdlib/array-base-assert-is-real-floating-point-data-type'; // eslint-disable-line id-length\nimport isSignedIntegerDataType from '@stdlib/array-base-assert-is-signed-integer-data-type';\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport { isPrimitive as isBigInt } from '@stdlib/assert-is-bigint';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isAllowedCast from '@stdlib/ndarray-base-assert-is-allowed-data-type-cast';\nimport minDataType from '@stdlib/array-min-dtype';\nimport minSignedIntegerDataType from '@stdlib/array-base-min-signed-integer-dtype';\nimport complexDType from '@stdlib/complex-dtype';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport boolean2number from './boolean2number.js';\nimport bigint2number from './bigint2number.js';\nimport PRIVATE_BUFFER from './private_buffer.js';\nimport defaults from './defaults.json';\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setNumber( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a number value to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar v;\n\t\tif ( isNumber( value ) ) {\n\t\t\tif ( isRealFloatingPointDataType( obj.type ) ) {\n\t\t\t\tdt = obj.type;\n\t\t\t} else if ( !isInteger( value ) ) {\n\t\t\t\tdt = defaults.dtypes.real;\n\t\t\t} else if ( isSignedIntegerDataType( obj.type ) ) {\n\t\t\t\tdt = minSignedIntegerDataType( value );\n\t\t\t} else {\n\t\t\t\tdt = minDataType( value );\n\t\t\t}\n\t\t\tv = value;\n\t\t} else if ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || ( ( obj.type === 'float32' ) ? 'complex64' : 'complex128' );\n\t\t\tv = value.re; // discard imaginary component\n\t\t} else if ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tv = boolean2number( value );\n\t\t} else if ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here\n\t\t\tv = bigint2number( value );\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tv = value;\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isBigInt } from '@stdlib/assert-is-bigint';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isAllowedCast from '@stdlib/ndarray-base-assert-is-allowed-data-type-cast';\nimport complexDType from '@stdlib/complex-dtype';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport boolean2number from './boolean2number.js';\nimport bigint2number from './bigint2number.js';\nimport PRIVATE_BUFFER from './private_buffer.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @param {string} method - data view method name\n* @returns {Function} function for writing field data\n*/\nfunction setComplex( obj, method ) {\n\treturn setter;\n\n\t/**\n\t* Writes a complex number to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {*} value - value to set\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dt;\n\t\tvar re;\n\t\tvar im;\n\t\tif ( isComplexLike( value ) ) {\n\t\t\tdt = complexDType( value ) || obj.type;\n\t\t\tre = value.re;\n\t\t\tim = value.im;\n\t\t} else if ( isNumber( value ) ) {\n\t\t\tdt = ( obj.type === 'complex64' ) ? 'float32' : 'float64';\n\t\t\tre = value;\n\t\t\tim = 0.0;\n\t\t} else if ( isBigInt( value ) ) {\n\t\t\tdt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here\n\t\t\tre = bigint2number( value );\n\t\t\tim = 0.0;\n\t\t} else if ( isBoolean( value ) ) {\n\t\t\tdt = 'bool';\n\t\t\tre = boolean2number( value );\n\t\t\tim = 0.0;\n\t\t} else {\n\t\t\tdt = 'generic';\n\t\t\tre = value;\n\t\t\tim = 0.0;\n\t\t}\n\t\tif ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) );\n\t\t}\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tview[ method ]( obj.byteOffset, re, IS_LITTLE_ENDIAN );\n\t\tview[ method ]( obj.byteOffset+(obj.byteLength/2), im, IS_LITTLE_ENDIAN );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setComplex;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport Uint8Array from '@stdlib/array-uint8';\nimport gcopy from '@stdlib/blas-base-gcopy';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport PRIVATE_BUFFER from './private_buffer.js';\nimport isStructInstance from './is_struct_instance.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for writing field data.\n*\n* @private\n* @param {Object} obj - field object\n* @returns {Function} function for writing field data\n*/\nfunction setStruct( obj ) {\n\treturn setter;\n\n\t/**\n\t* Writes `struct` data to an underlying byte buffer.\n\t*\n\t* @private\n\t* @param {Object} value - value to set\n\t* @throws {TypeError} must be a `struct` instance\n\t* @throws {RangeError} must be a `struct` instance having the same byte length\n\t* @throws {TypeError} cannot cast provided values to field data type\n\t*/\n\tfunction setter( value ) {\n\t\tvar view;\n\t\tvar dest;\n\t\tvar src;\n\t\tvar buf;\n\t\tvar nb;\n\t\tif ( !isStructInstance( value ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a `struct` instance. Value: `%s`.', obj.name, value ) );\n\t\t}\n\t\tif ( obj.casting === 'none' && !( value instanceof obj.type ) ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Value: `%s`.', obj.name, value ) );\n\t\t}\n\t\tnb = obj.byteLength;\n\n\t\tbuf = this.constructor.viewOf( value );\n\t\tif ( buf.byteLength !== nb ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be a `struct` instance having the same byte length.', obj.name ) );\n\t\t}\n\t\tsrc = new Uint8Array( buf.buffer, buf.byteOffset, nb );\n\n\t\tview = this[ PRIVATE_BUFFER ];\n\t\tdest = new Uint8Array( view.buffer, view.byteOffset+obj.byteOffset, nb ); // eslint-disable-line max-len\n\n\t\tgcopy( obj.length, src, 1, dest, 1 );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default setStruct;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar FIELD_PROPERTIES = [\n\t'name',\n\t'type',\n\t'description',\n\t'length',\n\t'enumerable',\n\t'writable',\n\t'default',\n\t'castingMode'\n];\n\n\n// EXPORTS //\n\nexport default FIELD_PROPERTIES;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isCollection from '@stdlib/assert-is-collection';\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating whether a field object represents a union type.\n*\n* @private\n* @param {Object} obj - input field object\n* @returns {boolean} result\n*/\nfunction isUnionType( obj ) {\n\treturn obj.type === 'union' && isCollection( obj.fields );\n}\n\n\n// EXPORTS //\n\nexport default isUnionType;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid boolean field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidBoolean( value, name ) {\n\tif ( isBoolean( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a boolean. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nexport default isValidBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar DTYPES = [\n\t'int8',\n\t'int16',\n\t'int32',\n\t'int64',\n\n\t'uint8',\n\t'uint16',\n\t'uint32',\n\t'uint64',\n\n\t// 'float16', // TODO: uncomment once supported\n\n\t'float32',\n\t'float64',\n\n\t// 'complex32', // TODO: uncomment once supported\n\n\t'complex64',\n\t'complex128',\n\n\t'bool'\n];\n\n\n// EXPORTS //\n\nexport default DTYPES;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar CASTING_MODES = [\n\t'none',\n\t'safe',\n\t'mostly-safe',\n\t'same-kind',\n\t'unsafe'\n];\n\n\n// EXPORTS //\n\nexport default CASTING_MODES;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 contains from '@stdlib/array-base-assert-contains';\nimport join from '@stdlib/array-base-join';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Returns a function for testing whether a provided value is a valid enumerated field.\n*\n* @private\n* @param {Collection} values - list of possible values\n* @returns {Function} output function\n*/\nfunction isValidOneOf( values ) {\n\treturn isValid;\n\n\t/**\n\t* Tests whether a provided value is a valid enumerated field.\n\t*\n\t* @private\n\t* @param {*} value - input value\n\t* @param {string} name - field name\n\t* @returns {(null|TypeError)} error object or null\n\t*/\n\tfunction isValid( value, name ) {\n\t\tif ( contains( values, value ) ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new TypeError( format( 'invalid argument. `%s` field must be one of the following: \"%s\". Value: `%s`.', name, join( values, ', ' ), value ) );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default isValidOneOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar ALIGNMENTS = {\n\t'int8': 1,\n\t'int16': 2,\n\t'int32': 4,\n\t'int64': 8,\n\n\t'uint8': 1,\n\t'uint16': 2,\n\t'uint32': 4,\n\t'uint64': 8,\n\n\t'float16': 2,\n\t'float32': 4,\n\t'float64': 8,\n\n\t'complex32': 2, // same as float16\n\t'complex64': 4, // same as float32\n\t'complex128': 8, // same as float64\n\n\t'bool': 1\n};\n\n\n// EXPORTS //\n\nexport default ALIGNMENTS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isStructConstructorLike from '@stdlib/assert-is-struct-constructor-like';\nimport hasProp from '@stdlib/assert-has-property';\nimport join from '@stdlib/array-base-join';\nimport constantFunction from '@stdlib/utils-constant-function';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport hasProperties from './has_properties.js';\nimport isValidNonEmptyString from './is_valid_nonempty_string.js';\nimport isValidString from './is_valid_string.js';\nimport isValidPositiveInteger from './is_valid_positive_integer.js';\nimport isValidBoolean from './is_valid_boolean.js';\nimport isValidType from './is_valid_type.js';\nimport isValidOneOf from './is_valid_one_of.js';\nimport initFieldObject from './init_field_object.js';\nimport byteLength from './byte_length.js';\nimport CASTING_MODES from './casting_modes.js';\nimport ALIGNMENTS from './alignments.js';\n\n\n// VARIABLES //\n\nvar MANDATORY_FIELD_NAMES = [\n\t'name',\n\t'type'\n];\n\nvar VALIDATORS = {\n\t'name': isValidNonEmptyString,\n\t'type': isValidType,\n\t'description': isValidString,\n\t'length': isValidPositiveInteger,\n\t'enumerable': isValidBoolean,\n\t'writable': isValidBoolean,\n\t'default': constantFunction( null ),\n\t'castingMode': isValidOneOf( CASTING_MODES )\n};\n\n\n// MAIN //\n\n/**\n* Normalizes a provided field object.\n*\n* @private\n* @param {Object} obj - input field object\n* @param {Array} keys - list of keys to standardize\n* @returns {(Object|Error)} output object or an error\n*/\nfunction normalize( obj, keys ) {\n\tvar out;\n\tvar err;\n\tvar v;\n\tvar k;\n\tvar i;\n\n\tout = initFieldObject();\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tk = keys[ i ];\n\t\tif ( hasProp( obj, k ) ) {\n\t\t\tv = obj[ k ];\n\t\t\terr = VALIDATORS[ k ]( v, k );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\tout[ k ] = v;\n\t\t}\n\t}\n\tif ( !hasProperties( out, MANDATORY_FIELD_NAMES ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Field objects must have the following properties: \"%s\". Value: `%s`.', join( MANDATORY_FIELD_NAMES, ', ' ), JSON.stringify( obj ) ) );\n\t}\n\tout.isStructType = isStructConstructorLike( out.type );\n\tout.byteLength = byteLength( out );\n\tif ( out.isStructType ) {\n\t\tout.alignment = out.type.alignment;\n\t} else {\n\t\tout.alignment = ALIGNMENTS[ out.type ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default normalize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid string field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidNonEmptyString( value, name ) {\n\tif ( isString( value ) || value.length > 0 ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a non-empty string. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nexport default isValidNonEmptyString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isStructConstructorLike from '@stdlib/assert-is-struct-constructor-like';\nimport contains from '@stdlib/array-base-assert-contains';\nimport join from '@stdlib/array-base-join';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport DTYPES from './dtypes.js';\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid `type` field.\n*\n* @private\n* @param {*} value - input value\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidType( value ) {\n\tif ( contains( DTYPES, value ) || isStructConstructorLike( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be either a struct type or one of the following: \"%s\". Value: `%s`.', 'type', join( DTYPES, ', ' ), value ) );\n}\n\n\n// EXPORTS //\n\nexport default isValidType;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid string field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidString( value, name ) {\n\tif ( isString( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a string. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nexport default isValidString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 { isPrimitive as isPositiveInteger } from '@stdlib/assert-is-positive-integer';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Tests whether a provided value is a valid positive integer field.\n*\n* @private\n* @param {*} value - input value\n* @param {string} name - field name\n* @returns {(null|TypeError)} error object or null\n*/\nfunction isValidPositiveInteger( value, name ) {\n\tif ( isPositiveInteger( value ) ) {\n\t\treturn null;\n\t}\n\treturn new TypeError( format( 'invalid argument. `%s` field must be a positive integer. Value: `%s`.', name, value ) );\n}\n\n\n// EXPORTS //\n\nexport default isValidPositiveInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Returns an initialized field object.\n*\n* @private\n* @returns {Object} initialized field object\n*/\nfunction initFieldObject() {\n\treturn {\n\t\t'isStructType': false,\n\t\t'description': '',\n\t\t'byteLength': 0,\n\t\t'byteOffset': 0,\n\t\t'alignment': 0,\n\t\t'padding': 0,\n\t\t'enumerable': true,\n\t\t'writable': true,\n\t\t'default': void 0, // explicitly set to `undefined`\n\t\t'castingMode': 'none'\n\t};\n}\n\n\n// EXPORTS //\n\nexport default initFieldObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 hasProp from '@stdlib/assert-has-property';\n\n\n// MAIN //\n\n/**\n* Tests whether an object has a list of properties.\n*\n* @private\n* @param {Object} obj - input object\n* @param {Array} keys - list of property names\n* @returns {boolean} result\n*/\nfunction hasProperties( obj, keys ) {\n\tvar i;\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tif ( !hasProp( obj, keys[ i ] ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nexport default hasProperties;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 bytesPerElement from '@stdlib/ndarray-base-bytes-per-element';\n\n\n// MAIN //\n\n/**\n* Returns the number of bytes required to store a field value.\n*\n* @private\n* @param {Object} obj - input field object\n* @returns {PositiveInteger} number of bytes\n*/\nfunction byteLength( obj ) {\n\tvar nb;\n\tif ( obj.isStructType ) {\n\t\tnb = obj.type.byteLength;\n\t} else {\n\t\tnb = bytesPerElement( obj.type );\n\t}\n\tif ( obj.length ) {\n\t\tnb *= obj.length;\n\t}\n\treturn nb;\n}\n\n\n// EXPORTS //\n\nexport default byteLength;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Resolves the struct's byte alignment.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @returns {PositiveInteger} alignment\n*/\nfunction alignment( fields ) {\n\tvar max;\n\tvar v;\n\tvar i;\n\n\tmax = 0;\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\tv = fields[ i ].alignment;\n\t\tif ( v > max ) {\n\t\t\tmax = v;\n\t\t}\n\t}\n\treturn max;\n}\n\n\n// EXPORTS //\n\nexport default alignment;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isObject from '@stdlib/assert-is-object';\nimport hasProp from '@stdlib/assert-has-property';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport isUnionType from './is_union_type.js';\nimport FIELD_PROPERTIES from './field_properties.js';\nimport normalizeField from './normalize_field.js';\nimport resolveAlignment from './resolve_alignment.js';\n\n\n// MAIN //\n\n/**\n* Normalizes a field object representing a union type.\n*\n* @private\n* @param {Object} obj - input field object\n* @returns {(Object|null|Error)} normalized field object or error object\n*/\nfunction normalizeUnion( obj ) {\n\tvar fields;\n\tvar dflg;\n\tvar out;\n\tvar tmp;\n\tvar len;\n\tvar o;\n\tvar i;\n\n\tfields = obj.fields;\n\tif ( fields.length === 0 ) {\n\t\treturn null;\n\t}\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tif ( !isObject( o ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( isUnionType( o ) ) {\n\t\t\treturn new TypeError( format( 'invalid argument. Union types cannot contain nested union types. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t}\n\t\tif ( dflg === void 0 && hasProp( o, 'default' ) ) {\n\t\t\tdflg = true;\n\t\t} else if ( dflg === true && hasProp( o, 'default' ) ) {\n\t\t\treturn new TypeError( format( 'invalid argument. Union types can only contain one field with a default value. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t}\n\t\ttmp = normalizeField( o, FIELD_PROPERTIES );\n\t\tif ( tmp instanceof Error ) {\n\t\t\treturn tmp;\n\t\t}\n\t\tif ( i === 0 ) {\n\t\t\tlen = tmp.byteLength;\n\t\t} else if ( tmp.byteLength !== len ) {\n\t\t\treturn new RangeError( format( 'invalid argument. Union types must contain fields having the same byte length. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t}\n\t\tout.push( tmp );\n\t}\n\treturn {\n\t\t'type': 'union',\n\t\t'fields': out,\n\t\t'byteLength': len,\n\t\t'byteOffset': 0,\n\t\t'alignment': resolveAlignment( out ),\n\t\t'padding': 0\n\t};\n}\n\n\n// EXPORTS //\n\nexport default normalizeUnion;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 indexOf from '@stdlib/array-base-index-of';\nimport join from '@stdlib/array-base-join';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Returns the index of a specified field name in a provided list of field names.\n*\n* @private\n* @param {Array} names - list of field names\n* @param {string} name - field name\n* @throws {Error} struct must have at least one field\n* @throws {TypeError} must provide a recognized field name\n* @returns {(integer|Error)} index or an error object\n*/\nfunction fieldIndex( names, name ) {\n\tvar idx;\n\tif ( names.length === 0 ) {\n\t\treturn new Error( 'invalid operation. struct does not have any fields.' );\n\t}\n\tidx = indexOf( names, name, 0 );\n\tif ( idx < 0 ) {\n\t\treturn new TypeError( format( 'invalid argument. Field name must be one of the following: \"%s\". Value: `%s`.', join( names, ', ' ), name ) );\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nexport default fieldIndex;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 min from '@stdlib/math-base-special-fast-min';\nimport isUnionType from './is_union_type.js';\n\n\n// FUNCTIONS //\n\n/**\n* Sets alignment padding for one or more field objects.\n*\n* ## Notes\n*\n* - This function mutates each field object.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @param {NonNegativeInteger} padding - alignment padding\n* @returns {Array} input array\n*/\nfunction setPadding( fields, padding ) {\n\tvar i;\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\tfields[ i ].padding = padding;\n\t}\n\treturn fields;\n}\n\n\n// MAIN //\n\n/**\n* Computes the byte offset for each field.\n*\n* ## Notes\n*\n* - This function mutates each field object.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @param {PositiveInteger} max - maximum alignment\n* @returns {Array} input array\n*/\nfunction byteOffsets( fields, max ) {\n\tvar alignment;\n\tvar padding;\n\tvar offset;\n\tvar tmp;\n\tvar o;\n\tvar i;\n\tvar j;\n\n\toffset = 0;\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// Resolve the alignment requirement for this field:\n\t\talignment = min( o.alignment, max );\n\n\t\t// Align the current offset to the required boundary:\n\t\tpadding = ( alignment-(offset%alignment) ) % alignment;\n\t\toffset += padding;\n\n\t\t// Set the padding for the previous member:\n\t\tif ( i > 0 ) {\n\t\t\ttmp = fields[ i-1 ];\n\t\t\ttmp.padding = padding;\n\t\t\tif ( isUnionType( o ) ) {\n\t\t\t\tsetPadding( tmp.fields, padding );\n\t\t\t}\n\t\t}\n\t\t// Set the offset for the current member:\n\t\to.byteOffset = offset;\n\n\t\t// If the current member is a union type, propagate the offset to its child field objects...\n\t\tif ( isUnionType( o ) ) {\n\t\t\tfor ( j = 0; j < o.fields.length; j++ ) {\n\t\t\t\to.fields[ j ].byteOffset = offset;\n\t\t\t}\n\t\t}\n\t\t// Advance the offset by the size, in bytes, of the member:\n\t\toffset += o.byteLength;\n\t}\n\t// Compute the padding for the last member:\n\tpadding = ( alignment - (offset%alignment) ) % alignment;\n\n\t// Set the padding for the last member:\n\to.padding = padding;\n\n\t// If the last member is a union type, propagate the offset to its child field objects...\n\tif ( isUnionType( o ) ) {\n\t\tsetPadding( o.fields, padding );\n\t}\n\n\treturn fields;\n}\n\n\n// EXPORTS //\n\nexport default byteOffsets;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 replace from '@stdlib/string-base-replace';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// FUNCTIONS //\n\n/**\n* Returns a new regular expression for matching byte parameters.\n*\n* @private\n* @returns {RegExp} regular expression\n*/\nfunction reByteOffset() {\n\treturn /\\[(\\d{1,}),/g;\n}\n\n/**\n* Returns a function for replacing byte values in a serialized struct.\n*\n* @private\n* @param {NonNegativeInteger} offset - byte offset\n* @returns {Function} replacer function\n*/\nfunction replacer( offset ) {\n\treturn wrapped;\n\n\t/**\n\t* Callback invoked for each match.\n\t*\n\t* @private\n\t* @param {string} match - matched substring\n\t* @param {string} p1 - first matched capture group substring\n\t* @returns {string} replacement string\n\t*/\n\tfunction wrapped( match, p1 ) {\n\t\treturn format( '[%u,', offset+parseInt( p1, 10 ) );\n\t}\n}\n\n\n// MAIN //\n\n/**\n* Serializes a struct to a layout format.\n*\n* ## Notes\n*\n* - The output format is a multi-column format having the following layout:\n*\n* ```text\n* | ...[byte_offset,byte_length] |\n* ```\n*\n* For example,\n*\n* ```text\n* |[0,8]|[8,1]|[16,16]|[32,8]|\n* ```\n*\n* @private\n* @param {Array} fields - list of normalized fields\n* @returns {string} string representation\n*/\nfunction layoutFormat( fields ) {\n\tvar out;\n\tvar tmp;\n\tvar re;\n\tvar N;\n\tvar o;\n\tvar i;\n\n\tN = fields.length;\n\n\t// Create a new regular expression for matching byte offsets:\n\tre = reByteOffset();\n\n\tout = [];\n\tfor ( i = 0; i < N; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// If we are currently processing fields in a union, move along to the next non-union field...\n\t\tif ( i > 0 && ( o.byteOffset === fields[ i-1 ].byteOffset ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\t// If the current type is a struct, we need to serialize and then post-process...\n\t\tif ( o.isStructType ) {\n\t\t\tout.push( replace( o.type.layout, re, replacer( o.byteOffset ) ) );\n\t\t\tcontinue;\n\t\t}\n\t\t// Format the field data:\n\t\tout.push( format( '|<%s>[%u,%u]', o.type, o.byteOffset, o.byteLength ) );\n\t}\n\ttmp = format( '%s|', out.join( '' ) );\n\n\t// If we having a trailing `||` due to a nested struct, remove the final `|`:\n\tif ( tmp[ tmp.length-2 ] === '|' ) {\n\t\ttmp = tmp.substring( 0, tmp.length-1 );\n\t}\n\treturn tmp;\n}\n\n\n// EXPORTS //\n\nexport default layoutFormat;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isPlainObject from '@stdlib/assert-is-plain-object';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport { factory as contains } from '@stdlib/array-base-assert-contains';\nimport join from '@stdlib/array-base-join';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport linearFormat from './format_linear.js';\nimport layoutFormat from './format_layout.js';\n\n\n// VARIABLES //\n\nvar FORMATS = [\n\t'none',\n\t'linear',\n\t'layout'\n];\nvar isFormat = contains( FORMATS );\n\n\n// MAIN //\n\n/**\n* Serializes a struct to a string.\n*\n* @private\n* @param {Function} Struct - struct constructor\n* @param {Array} fields - list of normalized fields\n* @param {Options} options - function options\n* @param {string} [options.format] - serialization format\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} string representation\n*/\nfunction toString( Struct, fields, options ) { // eslint-disable-line stdlib/no-redeclare\n\tvar opts;\n\tif ( !isPlainObject( options ) ) {\n\t\tthrow new TypeError( format( 'null2V', options ) );\n\t}\n\topts = {\n\t\t'format': 'none'\n\t};\n\tif ( hasOwnProp( options, 'format' ) ) {\n\t\topts.format = options.format;\n\t\tif ( !isFormat( opts.format ) ) {\n\t\t\tthrow new TypeError( format( 'null4S', 'format', join( FORMATS, ', ' ), options.format ) );\n\t\t}\n\t}\n\tif ( opts.format === 'linear' ) {\n\t\treturn linearFormat( Struct, fields );\n\t}\n\tif ( opts.format === 'layout' ) {\n\t\treturn layoutFormat( fields );\n\t}\n\t// Case: opts.format === 'none'\n\treturn '';\n}\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 floor from '@stdlib/math-base-special-floor';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Serializes a struct to a linear string format.\n*\n* ## Notes\n*\n* - The output format is a three-column format having the following layout:\n*\n* ```text\n* | byte_number | [field|padding] | notes |\n* ```\n*\n* - Nested `struct` instances are intentionally treated as opaque types, as we have limited access to struct internals (e.g., packed versus unpacked, field padding, etc), and we would effectively have to recompute all alignments and associated field data for the purposes of rendering. A user can always separately render a nested `struct` instance to a string in order to better understand its layout independently of its surrounding context in a parent `struct` instance.\n*\n* @private\n* @param {Function} Struct - struct constructor\n* @param {Array} fields - list of normalized fields\n* @returns {string} string representation\n*/\nfunction linearFormat( Struct, fields ) {\n\tvar nbytes;\n\tvar fmt0;\n\tvar fmt1;\n\tvar fmt2;\n\tvar bfmt;\n\tvar ufmt;\n\tvar fmt;\n\tvar tmp;\n\tvar out;\n\tvar flg;\n\tvar ib;\n\tvar c0;\n\tvar c1;\n\tvar c2;\n\tvar w0;\n\tvar w1;\n\tvar w;\n\tvar N;\n\tvar o;\n\tvar f;\n\tvar t;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tN = fields.length;\n\n\t// Resolve the size of the struct:\n\tnbytes = Struct.byteLength;\n\n\t// Compute the width of the first column:\n\tw0 = ( nbytes-1 ).toString().length;\n\n\t// Define a format string for the first column:\n\tfmt0 = '%'+w0+'s';\n\n\t// Determine the longest field name...\n\tw1 = 0;\n\tfor ( i = 0; i < N; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// Format: []\n\t\tw = o.name.length + 1 + ( o.byteLength-1 ).toString().length + 1;\n\t\tif ( w > w1 ) {\n\t\t\tw1 = w;\n\t\t}\n\t}\n\t// Define a format string for the second column:\n\tfmt1 = '%'+w1+'s';\n\n\t// Define a format string for the third column:\n\tfmt2 = '// %s';\n\n\t// Define a format string which combines the columns:\n\tfmt = '%s: %s %s';\n\n\t// Initialize a byte counter:\n\tib = 0;\n\n\tout = [];\n\tfor ( i = 0; i < N; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// If we are currently processing fields in a union, move along to the next non-union field...\n\t\tif ( i > 0 && ( o.byteOffset === fields[ i-1 ].byteOffset ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\t// Check whether this field is the first field of a union...\n\t\tif ( i < N-1 ) {\n\t\t\tflg = ( o.byteOffset === fields[ i+1 ].byteOffset );\n\t\t} else {\n\t\t\tflg = false;\n\t\t}\n\t\tfor ( j = 0; j < o.byteLength; j++ ) {\n\t\t\t// In the first column, render the byte number:\n\t\t\tc0 = format( fmt0, ib.toString() );\n\n\t\t\t// In the second column, render the field name and the byte number relative to the field:\n\t\t\tc1 = format( fmt1, format( '%s[%u]', o.name, j ) );\n\n\t\t\t// If a field type spans multiple bytes, render the byte number:\n\t\t\tif ( o.alignment > 1 ) {\n\t\t\t\tbfmt = ' (byte %u)';\n\t\t\t} else {\n\t\t\t\tbfmt = '';\n\t\t\t}\n\t\t\t// If a field is part of a union, make that explicit:\n\t\t\tif ( flg ) {\n\t\t\t\tufmt = ' => union: %s';\n\t\t\t\ttmp = [];\n\t\t\t\tk = i + 1;\n\t\t\t\twhile ( k < N && o.byteOffset === fields[ k ].byteOffset ) {\n\t\t\t\t\tf = fields[ k ];\n\t\t\t\t\tif ( f.isStructType ) {\n\t\t\t\t\t\tt = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tt = f.type;\n\t\t\t\t\t}\n\t\t\t\t\ttmp.push( format( '%s<%s>[%u]', f.name, t, j%f.alignment ) );\n\t\t\t\t\tk += 1;\n\t\t\t\t}\n\t\t\t\tufmt = format( ufmt, tmp.join( ', ' ) );\n\t\t\t} else {\n\t\t\t\tufmt = '';\n\t\t\t}\n\t\t\ttmp = format( bfmt+ufmt, j%o.alignment );\n\n\t\t\t// If a field contains multiple elements (i.e., is an array), render the field type along with the element number:\n\t\t\tif ( o.length ) {\n\t\t\t\tc2 = format( fmt2, format( '%s[%u]%s', o.type, floor( j/o.alignment ), tmp ) );\n\t\t\t}\n\t\t\t// Otherwise, just render the field type:\n\t\t\telse {\n\t\t\t\tc2 = format( fmt2, format( '%s%s', o.type, tmp ) );\n\t\t\t}\n\t\t\t// Render the row string:\n\t\t\tout.push( format( fmt, c0, c1, c2 ) );\n\t\t\tib += 1;\n\t\t}\n\t\tfor ( j = 0; j < o.padding; j++ ) {\n\t\t\tc0 = format( fmt0, ib.toString() );\n\t\t\tc1 = format( fmt1, '--' );\n\t\t\tc2 = format( fmt2, 'padding' );\n\t\t\tout.push( format( fmt, c0, c1, c2 ) );\n\t\t\tib += 1;\n\t\t}\n\t}\n\treturn out.join( '\\n' );\n}\n\n\n// EXPORTS //\n\nexport default linearFormat;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable no-restricted-syntax, id-length, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setNonEnumerableReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport isStructConstructorLike from '@stdlib/assert-is-struct-constructor-like';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport isCollection from '@stdlib/assert-is-collection';\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport isObject from '@stdlib/assert-is-object';\nimport hasProp from '@stdlib/assert-has-property';\nimport min from '@stdlib/math-base-special-fast-min';\nimport filled from '@stdlib/array-base-filled';\nimport ArrayBuffer from '@stdlib/array-buffer';\nimport DataView from '@stdlib/array-dataview';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport PRIVATE_BUFFER from './private_buffer.js';\nimport CTOR_NAME from './ctor_name.js';\nimport createPrototypeAccessors from './create_prototype_accessors.js';\nimport isStructInstance from './is_struct_instance.js';\nimport normalize from './normalize_field_list.js';\nimport fieldNames from './field_names.js';\nimport fieldIndex from './field_index.js';\nimport resolveAlignment from './resolve_alignment.js';\nimport byteOffsets from './byte_offsets.js';\nimport partitions from './partitions.js';\nimport flatten from './flatten_fields.js';\nimport struct2string from './to_string.js';\nimport struct2json from './to_json.js';\nimport layoutFormat from './format_layout.js';\n\n\n// MAIN //\n\n/**\n* Returns a constructor for creating a fixed-width composite data type (a.k.a., a `struct`).\n*\n* @param {ObjectArray} fields - structure fields\n* @throws {TypeError} first argument must be an array-like object containing objects\n* @throws {TypeError} field objects must have required properties\n* @throws {TypeError} field objects must have valid fields\n* @throws {TypeError} union types must be array-like objects containing objects\n* @throws {RangeError} union types must contain fields having the same byte length\n* @throws {TypeError} union types cannot contain nested union types\n* @throws {TypeError} union types can only contain one field with a default value\n* @throws {Error} unexpected error\n* @returns {Function} constructor\n*\n* @example\n* var fields = [\n* {\n* 'type': 'union',\n* 'fields': [\n* {\n* 'name': 'double',\n* 'description': 'double-precision floating-point number',\n* 'type': 'float64',\n* 'enumerable': true,\n* 'writable': true,\n* 'castingMode': 'none'\n* },\n* {\n* 'name': 'words',\n* 'description': 'high and low words',\n* 'type': 'uint32',\n* 'length': 2,\n* 'enumerable': true,\n* 'writable': true,\n* 'castingMode': 'none'\n* }\n* ]\n* }\n* ];\n* var Struct = factory( fields );\n*\n* var data = {\n* 'double': 3.14\n* };\n* var s = new Struct( data );\n* // returns \n*\n* var v = s.double;\n* // returns 3.14\n*\n* var w = s.words;\n* // e.g., [ 1374389535, 1074339512 ]\n*/\nfunction factory( fields ) {\n\tvar FIELD_NAMES;\n\tvar BYTE_LENGTH;\n\tvar PARTITIONS;\n\tvar ALIGNMENT;\n\tvar ACCESSORS;\n\tvar FIELDS;\n\tvar tmp;\n\tvar o;\n\tif ( !isCollection( fields ) ) {\n\t\tthrow new TypeError( format( 'null2O', fields ) );\n\t}\n\t// Normalize the list of field objects:\n\ttmp = normalize( fields );\n\tif ( tmp instanceof Error ) {\n\t\tthrow tmp;\n\t}\n\tFIELDS = tmp;\n\n\t// Resolve the list of unique field names:\n\ttmp = fieldNames( FIELDS );\n\tif ( tmp instanceof Error ) {\n\t\tthrow tmp;\n\t}\n\tFIELD_NAMES = tmp;\n\n\t// Resolve the struct's alignment requirements:\n\tALIGNMENT = resolveAlignment( FIELDS );\n\n\t// Compute the byte offset for each field:\n\tFIELDS = byteOffsets( FIELDS, ALIGNMENT );\n\n\t// Now that we've finished processing provided field objects, flatten the list, such that union types are implied by field objects having the same byte offset:\n\tFIELDS = flatten( FIELDS );\n\n\t// Compute field \"partitions\" (i.e., non-overlapping views):\n\tPARTITIONS = partitions( FIELDS );\n\n\t// Compute the struct's byte length:\n\to = FIELDS[ FIELDS.length-1 ];\n\tBYTE_LENGTH = o.byteOffset + o.byteLength + o.padding;\n\n\t/**\n\t* Constructor for a composite data type (a.k.a., a `struct`).\n\t*\n\t* @private\n\t* @param {(Object|ArrayBuffer)} [arg] - array buffer or data object\n\t* @param {NonNegativeInteger} [byteOffset=0] - offset, in bytes, to the first byte in a provided buffer for the returned `struct` to reference\n\t* @param {NonNegativeInteger} [byteLength] - maximum number of elements in the byte array\n\t* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n\t* @throws {TypeError} second argument must be a nonnegative integer\n\t* @throws {TypeError} third argument must be a nonnegative integer\n\t* @throws {Error} union types may only be initialized by a single member\n\t* @returns {Struct} struct instance\n\t*/\n\tfunction Struct( arg, byteOffset, byteLength ) {\n\t\tvar values;\n\t\tvar nargs;\n\t\tvar cache;\n\t\tvar view;\n\t\tvar obj;\n\t\tvar o;\n\t\tvar v;\n\t\tvar i;\n\t\tvar j;\n\t\tvar k;\n\n\t\tnargs = arguments.length;\n\t\tif ( !( this instanceof Struct ) ) {\n\t\t\tif ( nargs === 0 ) {\n\t\t\t\treturn new Struct();\n\t\t\t}\n\t\t\tif ( nargs === 1 ) {\n\t\t\t\treturn new Struct( arg );\n\t\t\t}\n\t\t\tif ( nargs === 2 ) {\n\t\t\t\treturn new Struct( arg, byteOffset );\n\t\t\t}\n\t\t\treturn new Struct( arg, byteOffset, byteLength );\n\t\t}\n\t\tif ( isArrayBuffer( arg ) ) {\n\t\t\tif ( nargs === 1 ) {\n\t\t\t\tview = new DataView( arg, 0, BYTE_LENGTH );\n\t\t\t} else {\n\t\t\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'null2C', byteOffset ) );\n\t\t\t\t}\n\t\t\t\tif ( nargs === 2 ) {\n\t\t\t\t\tview = new DataView( arg, byteOffset, BYTE_LENGTH );\n\t\t\t\t} else {\n\t\t\t\t\tif ( !isNonNegativeInteger( byteLength ) ) {\n\t\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Byte length must be a nonnegative integer. Value: `%s`.', byteLength ) );\n\t\t\t\t\t}\n\t\t\t\t\tview = new DataView( arg, byteOffset, min( byteLength, BYTE_LENGTH ) ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( view.byteLength < BYTE_LENGTH ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer has insufficient capacity. Minimum capacity: `%u`.', BYTE_LENGTH ) );\n\t\t\t}\n\t\t} else {\n\t\t\tview = new DataView( new ArrayBuffer( BYTE_LENGTH ) );\n\t\t\tif ( nargs > 0 ) {\n\t\t\t\tif ( !isObject( arg ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'null3L', arg ) );\n\t\t\t\t}\n\t\t\t\tobj = arg;\n\t\t\t}\n\t\t}\n\t\t// Bind the byte buffer to the current instance:\n\t\tsetReadOnly( this, PRIVATE_BUFFER, view );\n\n\t\t// If we were provided a data object, set provided fields...\n\t\tif ( obj !== void 0 ) {\n\t\t\t// Initialize an array containing values to set:\n\t\t\tvalues = filled( void 0, FIELDS.length );\n\n\t\t\t// For each field, determine whether a value has been specified...\n\t\t\tcache = {};\n\t\t\tfor ( i = 0; i < FIELDS.length; i++ ) {\n\t\t\t\tk = FIELD_NAMES[ i ];\n\t\t\t\tj = PARTITIONS[ i ];\n\t\t\t\tif ( hasProp( obj, k ) ) {\n\t\t\t\t\t// Check whether a value has already been specified for this view (i.e., via another union member)...\n\t\t\t\t\tif ( cache[ j ] ) {\n\t\t\t\t\t\tthrow new Error( 'invalid argument. Union types may only be initialized by a single member.' );\n\t\t\t\t\t}\n\t\t\t\t\tvalues[ i ] = obj[ k ];\n\t\t\t\t\tcache[ j ] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Perform a second pass over the fields to fill in default initial values...\n\t\t\tfor ( i = 0; i < FIELDS.length; i++ ) {\n\t\t\t\tj = PARTITIONS[ i ];\n\t\t\t\tif ( cache[ j ] ) {\n\t\t\t\t\t// Skip fields already having initial values...\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\to = FIELDS[ i ];\n\t\t\t\tif ( o.default !== void 0 ) {\n\t\t\t\t\tvalues[ i ] = o.default;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Set all fields with initialization values...\n\t\t\tfor ( i = 0; i < FIELDS.length; i++ ) {\n\t\t\t\tv = values[ i ];\n\t\t\t\tif ( v !== void 0 ) {\n\t\t\t\t\tACCESSORS[ FIELD_NAMES[ i ] ][ 1 ].call( this, v );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t* Constructor name.\n\t*\n\t* @private\n\t* @name name\n\t* @memberof Struct\n\t* @readonly\n\t* @type {string}\n\t* @default 'Struct'\n\t*/\n\tsetReadOnly( Struct, 'name', CTOR_NAME );\n\n\t/**\n\t* Alignment.\n\t*\n\t* @private\n\t* @name alignment\n\t* @memberof Struct\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( Struct, 'alignment', ALIGNMENT );\n\n\t/**\n\t* Size (in bytes) of the `struct`.\n\t*\n\t* @private\n\t* @name byteLength\n\t* @memberof Struct\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( Struct, 'byteLength', BYTE_LENGTH );\n\n\t/**\n\t* Returns a list of `struct` fields.\n\t*\n\t* @private\n\t* @name fields\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Array}\n\t*/\n\tsetNonEnumerableReadOnlyAccessor( Struct, 'fields', function get() {\n\t\treturn FIELD_NAMES.slice();\n\t});\n\n\t/**\n\t* Returns a string corresponding to the `struct` layout.\n\t*\n\t* @private\n\t* @name layout\n\t* @memberof Struct\n\t* @readonly\n\t* @type {string}\n\t*/\n\tsetNonEnumerableReadOnlyAccessor( Struct, 'layout', function get() {\n\t\t// As this is not likely to be a commonly used API, intentionally recompute the layout format in order to avoid consuming memory for what could be a long string...\n\t\treturn layoutFormat( FIELDS );\n\t});\n\n\t/**\n\t* Returns the underlying byte buffer of a `struct`.\n\t*\n\t* @private\n\t* @name bufferOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {Object} obj - struct instance\n\t* @throws {TypeError} must provide a `struct` instance\n\t* @returns {ArrayBuffer} underlying byte buffer\n\t*/\n\tsetReadOnly( Struct, 'bufferOf', function bufferOf( obj ) {\n\t\tif ( !isStructInstance( obj ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a `struct` instance. Value: `%s`.', obj ) );\n\t\t}\n\t\treturn obj[ PRIVATE_BUFFER ].buffer;\n\t});\n\n\t/**\n\t* Returns the length, in bytes, of the value specified by the provided field name.\n\t*\n\t* @private\n\t* @name byteLengthOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {NonNegativeInteger} byte length\n\t*/\n\tsetReadOnly( Struct, 'byteLengthOf', function byteLengthOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].byteLength;\n\t});\n\n\t/**\n\t* Returns the offset, in bytes, from the beginning of a `struct` to the value specified by the provided field name.\n\t*\n\t* @private\n\t* @name byteOffsetOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {NonNegativeInteger} byte offset\n\t*/\n\tsetReadOnly( Struct, 'byteOffsetOf', function byteOffsetOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].byteOffset;\n\t});\n\n\t/**\n\t* Returns the description associated with a provided field name.\n\t*\n\t* @private\n\t* @name descriptionOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {string} description\n\t*/\n\tsetReadOnly( Struct, 'descriptionOf', function descriptionOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].description;\n\t});\n\n\t/**\n\t* Returns a boolean indicating whether a provided value is a `struct` instance.\n\t*\n\t* @private\n\t* @name isStruct\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {*} value - input value\n\t* @returns {boolean} boolean indicating whether a value is a `struct` instance\n\t*/\n\tsetReadOnly( Struct, 'isStruct', function isStruct( value ) {\n\t\treturn (\n\t\t\tvalue instanceof Struct ||\n\t\t\t(\n\t\t\t\tisStructInstance( value ) &&\n\t\t\t\tisStructConstructorLike( value.constructor )\n\t\t\t)\n\t\t);\n\t});\n\n\t/**\n\t* Returns the type associated with a provided field name.\n\t*\n\t* @private\n\t* @name typeOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {string} name - field name\n\t* @throws {Error} struct must have at least one field\n\t* @throws {TypeError} must provide a recognized field name\n\t* @returns {(string|Object)} type\n\t*/\n\tsetReadOnly( Struct, 'typeOf', function typeOf( name ) {\n\t\tvar idx = fieldIndex( FIELD_NAMES, name );\n\t\tif ( idx instanceof Error ) {\n\t\t\tthrow idx;\n\t\t}\n\t\treturn FIELDS[ idx ].type;\n\t});\n\n\t/**\n\t* Returns the underlying byte buffer of a `struct` as a `DataView`.\n\t*\n\t* @private\n\t* @name viewOf\n\t* @memberof Struct\n\t* @readonly\n\t* @type {Function}\n\t* @param {Object} obj - struct instance\n\t* @throws {TypeError} must provide a `struct` instance\n\t* @returns {DataView} view of underlying byte buffer\n\t*/\n\tsetReadOnly( Struct, 'viewOf', function viewOf( obj ) {\n\t\tvar buf;\n\t\tif ( !isStructInstance( obj ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a `struct` instance. Value: `%s`.', obj ) );\n\t\t}\n\t\tbuf = obj[ PRIVATE_BUFFER ];\n\t\treturn new DataView( buf.buffer, buf.byteOffset, buf.byteLength );\n\t});\n\n\t// Create prototype accessors for getting and setting field values:\n\tACCESSORS = createPrototypeAccessors( Struct.prototype, FIELDS );\n\n\t/**\n\t* Serializes a `struct` to a string.\n\t*\n\t* @private\n\t* @name toString\n\t* @memberof Struct.prototype\n\t* @readonly\n\t* @type {Function}\n\t* @param {Options} [options] - function options\n\t* @param {string} [options.format='none'] - serialization format\n\t* @throws {Error} `this` must be a struct instance\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {string} serialized `struct` instance\n\t*/\n\tsetReadOnly( Struct.prototype, 'toString', function toString() {\n\t\tvar opts;\n\t\tif ( !( this instanceof Struct ) ) {\n\t\t\tthrow new Error( 'invalid invocation. `this` is not a struct instance.' );\n\t\t}\n\t\tif ( arguments.length > 0 ) {\n\t\t\topts = arguments[ 0 ];\n\t\t} else {\n\t\t\topts = {};\n\t\t}\n\t\treturn struct2string( Struct, FIELDS, opts );\n\t});\n\n\t/**\n\t* Serializes a `struct` to JSON.\n\t*\n\t* @private\n\t* @name toJSON\n\t* @memberof Struct.prototype\n\t* @readonly\n\t* @type {Function}\n\t* @throws {Error} `this` must be a struct instance\n\t* @returns {JSON} serialized `struct` instance\n\t*/\n\tsetReadOnly( Struct.prototype, 'toJSON', function toJSON() {\n\t\tif ( !( this instanceof Struct ) ) {\n\t\t\tthrow new Error( 'invalid invocation. `this` is not a struct instance.' );\n\t\t}\n\t\treturn struct2json( this, FIELDS );\n\t});\n\n\treturn Struct;\n}\n\n\n// EXPORTS //\n\nexport default factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isObject from '@stdlib/assert-is-object';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport FIELD_PROPERTIES from './field_properties.js';\nimport isUnionType from './is_union_type.js';\nimport normalizeField from './normalize_field.js';\nimport normalizeUnion from './normalize_union.js';\n\n\n// MAIN //\n\n/**\n* Normalizes a list of field objects.\n*\n* @private\n* @param {Array} fields - input fields\n* @returns {(Array|Error)} normalized field objects or an error\n*/\nfunction normalize( fields ) {\n\tvar out;\n\tvar tmp;\n\tvar o;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tif ( !isObject( o ) ) {\n\t\t\treturn new TypeError( format( 'invalid argument. First argument must be an array of objects. Value: `%s`. Index: `%d`.', o, i ) );\n\t\t}\n\t\t// Check for a union type which is a collection of nested field objects which all have the same byte length...\n\t\tif ( isUnionType( o ) ) {\n\t\t\ttmp = normalizeUnion( o );\n\t\t\tif ( tmp === null ) {\n\t\t\t\treturn new TypeError( format( 'invalid argument. Union types must be an array of objects. Value: `%s`. Index: `%d`.', JSON.stringify( o ), i ) );\n\t\t\t}\n\t\t\tif ( tmp instanceof Error ) {\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t} else {\n\t\t\ttmp = normalizeField( o, FIELD_PROPERTIES );\n\t\t\tif ( tmp instanceof Error ) {\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t}\n\t\tout.push( tmp );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default normalize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 format from '@stdlib/error-tools-fmtprodmsg';\nimport isUnionType from './is_union_type.js';\n\n\n// MAIN //\n\n/**\n* Resolves a list of field names.\n*\n* @private\n* @param {Array} fields - list of field objects\n* @returns {(Array|Error)} list of field names or an error\n*/\nfunction fieldNames( fields ) {\n\tvar hash;\n\tvar out;\n\tvar o1;\n\tvar o2;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\thash = {};\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to1 = fields[ i ];\n\t\tk = o1.name;\n\t\tif ( isUnionType( o1 ) ) {\n\t\t\tfor ( j = 0; j < o1.fields.length; j++ ) {\n\t\t\t\to2 = o1.fields[ j ];\n\t\t\t\tk = o2.name;\n\t\t\t\tif ( hash[ k ] === true ) {\n\t\t\t\t\treturn new TypeError( format( 'invalid argument. First argument must be an array of objects having unique field names. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t\t\t}\n\t\t\t\thash[ k ] = true;\n\t\t\t\tout.push( k );\n\t\t\t}\n\t\t} else if ( hash[ k ] === true ) {\n\t\t\treturn new TypeError( format( 'invalid argument. First argument must be an array of objects having unique field names. Value: `%s`.', JSON.stringify( fields ) ) );\n\t\t} else {\n\t\t\thash[ k ] = true;\n\t\t\tout.push( k );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fieldNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isUnionType from './is_union_type.js';\n\n\n// MAIN //\n\n/**\n* Flattens a list of field objects.\n*\n* @private\n* @param {Array} fields - list of field objects\n* @returns {Array} new list\n*/\nfunction flatten( fields ) {\n\tvar out;\n\tvar o;\n\tvar i;\n\tvar j;\n\n\tout = [];\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tif ( isUnionType( o ) ) {\n\t\t\tfor ( j = 0; j < o.fields.length; j++ ) {\n\t\t\t\tout.push( o.fields[ j ] );\n\t\t\t}\n\t\t} else {\n\t\t\tout.push( o );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default flatten;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\n/**\n* Returns a list of partition indices.\n*\n* ## Notes\n*\n* - This function partitions field objects according to whether a field object represents a unique \"view\" over an underlying byte buffer. Field objects within a union belong to the same partition.\n*\n* @private\n* @param {Array} fields - list of normalized field objects\n* @returns {NonNegativeIntegerArray} list of indices\n*/\nfunction partitions( fields ) {\n\tvar out;\n\tvar N;\n\tvar o;\n\tvar i;\n\tvar j;\n\n\tN = fields.length;\n\n\tout = [];\n\tj = 0;\n\tfor ( i = 0; i < N-1; i++ ) {\n\t\to = fields[ i ];\n\n\t\t// Check for the start of a union...\n\t\tif ( o.byteOffset === fields[ i+1 ].byteOffset ) {\n\t\t\tout.push( j );\n\t\t\tcontinue;\n\t\t}\n\t\tout.push( j );\n\t\tj += 1;\n\t}\n\t// Set the partition for the last field object:\n\tout.push( j );\n\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default partitions;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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// MAIN //\n\nvar CTOR_NAME = 'Struct';\n\n\n// EXPORTS //\n\nexport default CTOR_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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/* eslint-disable id-length */\n\n'use strict';\n\n// MODULES //\n\nimport setNonEnumerableReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport setNonEnumerableReadWriteAccessor from '@stdlib/utils-define-nonenumerable-read-write-accessor';\nimport setReadOnlyAccessor from '@stdlib/utils-define-read-only-accessor';\nimport setReadWriteAccessor from '@stdlib/utils-define-read-write-accessor';\nimport getter from './getter.js';\nimport setter from './setter.js';\n\n\n// MAIN //\n\n/**\n* Assigns methods for accessing field values to a provided prototype.\n*\n* @private\n* @param {Object} p - prototype\n* @param {Array} fields - field objects\n* @returns {Object} object containing accessors for each field\n*/\nfunction createPrototypeAccessors( p, fields ) {\n\tvar get;\n\tvar set;\n\tvar out;\n\tvar o;\n\tvar i;\n\n\tout = {};\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tget = getter( o );\n\t\tset = setter( o );\n\t\tif ( o.enumerable ) {\n\t\t\tif ( o.writable ) {\n\t\t\t\tsetReadWriteAccessor( p, o.name, get, set );\n\t\t\t} else {\n\t\t\t\tsetReadOnlyAccessor( p, o.name, get );\n\t\t\t}\n\t\t} else if ( o.writable ) {\n\t\t\tsetNonEnumerableReadWriteAccessor( p, o.name, get, set );\n\t\t} else {\n\t\t\tsetNonEnumerableReadOnlyAccessor( p, o.name, get );\n\t\t}\n\t\tout[ o.name ] = [ get, set ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default createPrototypeAccessors;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 isCollection from '@stdlib/assert-is-collection';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isFunction from '@stdlib/assert-is-function';\nimport typedarray2json from '@stdlib/array-to-json';\nimport isStructInstance from './is_struct_instance.js';\n\n\n// MAIN //\n\n/**\n* Serializes a `struct` instance to JSON.\n*\n* @private\n* @param {Struct} struct - struct instance\n* @param {Array} fields - list of normalized fields\n* @returns {Object} JSON representation\n*/\nfunction toJSON( struct, fields ) {\n\tvar out;\n\tvar o;\n\tvar v;\n\tvar i;\n\n\tout = {};\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\to = fields[ i ];\n\t\tv = struct[ o.name ];\n\t\tif ( isCollection( v ) ) {\n\t\t\tv = typedarray2json( v );\n\t\t} else if ( isStructInstance( v ) ) {\n\t\t\tv = v.toJSON();\n\t\t} else if ( isComplexLike( v ) && isFunction( v.toJSON ) ) {\n\t\t\tv = v.toJSON();\n\t\t}\n\t\tout[ o.name ] = v;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\n"],"names":["PRIVATE_BUFFER","DATA_VIEW_METHODS","int8","get","set","int16","int32","int64","uint8","uint16","uint32","uint64","float16","float32","float64","complex32","complex64","complex128","bool","CMPLX_TO_REAL","getter","obj","length","isStructType","offset","view","out","i","this","byteOffset","push","type","buffer","byteLength","getStructArray","typedarray","getTypedArray","method","IS_LITTLE_ENDIAN","getBigInt","Boolean","getBoolean","re","im","complex","getComplex","getStruct","Error","format","boolean2number","value","bigint2number","Number","number2boolean","complex2boolean","setBoolean","dt","v","isBoolean","isNumber","defaults","dtypes","real","isBigInt","bigint2boolean","isComplexLike","complexDType","isAllowedCast","castingMode","TypeError","name","setBigInt","isInteger","minDataType","BigInt","floor","boolean2bigint","isStructInstance","isObject","isDataView","complex2number","setter","values","views","dest","src","buf","nb","isCollection","RangeError","casting","constructor","viewOf","Uint8Array","gcopy","setStructArray","dtype","isComplexDataType","reinterpretComplex","isBooleanDataType","reinterpretBoolean","isRealDataType","gfill","ndarray","map","assign","setTypedArray","isRealFloatingPointDataType","isSignedIntegerDataType","minSignedIntegerDataType","setNumber","setComplex","setStruct","FIELD_PROPERTIES","isUnionType","fields","isValidBoolean","DTYPES","ALIGNMENTS","MANDATORY_FIELD_NAMES","VALIDATORS","isString","contains","isStructConstructorLike","join","description","isPositiveInteger","enumerable","writable","default","constantFunction","normalize","keys","err","k","alignment","padding","hasProp","hasProperties","bytesPerElement","JSON","stringify","max","normalizeUnion","dflg","tmp","len","o","normalizeField","resolveAlignment","fieldIndex","names","idx","indexOf","setPadding","replacer","match","p1","parseInt","layoutFormat","N","replace","layout","substring","FORMATS","isFormat","toString","Struct","options","opts","isPlainObject","hasOwnProp","fmt0","fmt1","fmt2","bfmt","ufmt","fmt","flg","ib","c0","c1","c2","w1","w","f","t","j","linearFormat","factory","FIELD_NAMES","BYTE_LENGTH","PARTITIONS","ALIGNMENT","ACCESSORS","FIELDS","hash","o1","fieldNames","arg","nargs","cache","arguments","isArrayBuffer","DataView","isNonNegativeInteger","min","ArrayBuffer","setReadOnly","filled","call","byteOffsets","flatten","partitions","setNonEnumerableReadOnlyAccessor","slice","p","setReadWriteAccessor","setReadOnlyAccessor","setNonEnumerableReadWriteAccessor","createPrototypeAccessors","prototype","struct2string","struct","typedarray2json","isFunction","toJSON","struct2json"],"mappings":";;kqMAuBA,IAAIA,GAAiB,wCCDjBC,GAAoB,CACvBC,KAAQ,CACPC,IAAO,UACPC,IAAO,WAERC,MAAS,CACRF,IAAO,WACPC,IAAO,YAERE,MAAS,CACRH,IAAO,WACPC,IAAO,YAERG,MAAS,CACRJ,IAAO,cACPC,IAAO,eAERI,MAAS,CACRL,IAAO,WACPC,IAAO,YAERK,OAAU,CACTN,IAAO,YACPC,IAAO,aAERM,OAAU,CACTP,IAAO,YACPC,IAAO,aAERO,OAAU,CACTR,IAAO,eACPC,IAAO,gBAERQ,QAAW,CACVT,IAAO,aACPC,IAAO,cAERS,QAAW,CACVV,IAAO,aACPC,IAAO,cAERU,QAAW,CACVX,IAAO,aACPC,IAAO,cAERW,UAAa,CACZZ,IAAO,aACPC,IAAO,cAERY,UAAa,CACZb,IAAO,aACPC,IAAO,cAERa,WAAc,CACbd,IAAO,aACPC,IAAO,cAERc,KAAQ,CACPf,IAAO,WACPC,IAAO,aClDT,IAAIe,GAAgB,CACnBF,WAAc,UACdD,UAAa,UACbD,UAAa,WCSd,SAASK,GAAQC,GAChB,GAAKA,EAAIC,OACR,OAAKD,EAAIE,aCTX,SAAyBF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EAAI,EAAGA,EAAIwF,EAAO7F,OAAQK,IAE/B8B,EAAIsK,GADJ5E,EAAIhC,EAAQxF,IACE2C,MACTkB,EAAc/B,GAClBA,EAAIuK,GAAiBvK,IACVoB,GAAkBpB,IAElBQ,GAAeR,IAAOwK,GAAYxK,EAAEyK,WAD/CzK,EAAIA,EAAEyK,UAIPxM,EAAKyH,EAAE7E,MAASb,EAEjB,OAAO/B,CACR,CPscSyM,CAAavM,KAAMuK,EAC5B,IAEQ5B,CACR"} \ No newline at end of file diff --git a/lib/alignments.js b/lib/alignments.js deleted file mode 100644 index 10dfc5a..0000000 --- a/lib/alignments.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -var ALIGNMENTS = { - 'int8': 1, - 'int16': 2, - 'int32': 4, - 'int64': 8, - - 'uint8': 1, - 'uint16': 2, - 'uint32': 4, - 'uint64': 8, - - 'float16': 2, - 'float32': 4, - 'float64': 8, - - 'complex32': 2, // same as float16 - 'complex64': 4, // same as float32 - 'complex128': 8, // same as float64 - - 'bool': 1 -}; - - -// EXPORTS // - -module.exports = ALIGNMENTS; diff --git a/lib/bigint2boolean.js b/lib/bigint2boolean.js deleted file mode 100644 index 7c98fbd..0000000 --- a/lib/bigint2boolean.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Boolean = require( '@stdlib/boolean-ctor' ); - - -// MAIN // - -/** -* Converts a BigInt to a boolean. -* -* @private -* @param {BigInt} value - input value -* @returns {boolean} result -*/ -function bigint2boolean( value ) { - return Boolean( value ); -} - - -// EXPORTS // - -module.exports = bigint2boolean; diff --git a/lib/bigint2number.js b/lib/bigint2number.js deleted file mode 100644 index 2282c2c..0000000 --- a/lib/bigint2number.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Number = require( '@stdlib/number-ctor' ); - - -// MAIN // - -/** -* Converts a BigInt to a number. -* -* @private -* @param {BigInt} value - input value -* @returns {number} result -*/ -function bigint2number( value ) { - return Number( value ); -} - - -// EXPORTS // - -module.exports = bigint2number; diff --git a/lib/boolean2bigint.js b/lib/boolean2bigint.js deleted file mode 100644 index d92560a..0000000 --- a/lib/boolean2bigint.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var BigInt = require( '@stdlib/bigint-ctor' ); - - -// MAIN // - -/** -* Converts a boolean to a BigInt. -* -* @private -* @param {boolean} value - input value -* @returns {number} result -*/ -function boolean2bigint( value ) { - return BigInt( ( value ) ? 1 : 0 ); -} - - -// EXPORTS // - -module.exports = boolean2bigint; diff --git a/lib/boolean2number.js b/lib/boolean2number.js deleted file mode 100644 index 9703af4..0000000 --- a/lib/boolean2number.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Converts a boolean to a number. -* -* @private -* @param {boolean} value - input value -* @returns {number} result -*/ -function boolean2number( value ) { - return ( value ) ? 1 : 0; -} - - -// EXPORTS // - -module.exports = boolean2number; diff --git a/lib/byte_length.js b/lib/byte_length.js deleted file mode 100644 index d205a37..0000000 --- a/lib/byte_length.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' ); - - -// MAIN // - -/** -* Returns the number of bytes required to store a field value. -* -* @private -* @param {Object} obj - input field object -* @returns {PositiveInteger} number of bytes -*/ -function byteLength( obj ) { - var nb; - if ( obj.isStructType ) { - nb = obj.type.byteLength; - } else { - nb = bytesPerElement( obj.type ); - } - if ( obj.length ) { - nb *= obj.length; - } - return nb; -} - - -// EXPORTS // - -module.exports = byteLength; diff --git a/lib/byte_offsets.js b/lib/byte_offsets.js deleted file mode 100644 index 9d80d44..0000000 --- a/lib/byte_offsets.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var min = require( '@stdlib/math-base-special-fast-min' ); -var isUnionType = require( './is_union_type.js' ); - - -// FUNCTIONS // - -/** -* Sets alignment padding for one or more field objects. -* -* ## Notes -* -* - This function mutates each field object. -* -* @private -* @param {Array} fields - list of normalized field objects -* @param {NonNegativeInteger} padding - alignment padding -* @returns {Array} input array -*/ -function setPadding( fields, padding ) { - var i; - for ( i = 0; i < fields.length; i++ ) { - fields[ i ].padding = padding; - } - return fields; -} - - -// MAIN // - -/** -* Computes the byte offset for each field. -* -* ## Notes -* -* - This function mutates each field object. -* -* @private -* @param {Array} fields - list of normalized field objects -* @param {PositiveInteger} max - maximum alignment -* @returns {Array} input array -*/ -function byteOffsets( fields, max ) { - var alignment; - var padding; - var offset; - var tmp; - var o; - var i; - var j; - - offset = 0; - for ( i = 0; i < fields.length; i++ ) { - o = fields[ i ]; - - // Resolve the alignment requirement for this field: - alignment = min( o.alignment, max ); - - // Align the current offset to the required boundary: - padding = ( alignment-(offset%alignment) ) % alignment; - offset += padding; - - // Set the padding for the previous member: - if ( i > 0 ) { - tmp = fields[ i-1 ]; - tmp.padding = padding; - if ( isUnionType( o ) ) { - setPadding( tmp.fields, padding ); - } - } - // Set the offset for the current member: - o.byteOffset = offset; - - // If the current member is a union type, propagate the offset to its child field objects... - if ( isUnionType( o ) ) { - for ( j = 0; j < o.fields.length; j++ ) { - o.fields[ j ].byteOffset = offset; - } - } - // Advance the offset by the size, in bytes, of the member: - offset += o.byteLength; - } - // Compute the padding for the last member: - padding = ( alignment - (offset%alignment) ) % alignment; - - // Set the padding for the last member: - o.padding = padding; - - // If the last member is a union type, propagate the offset to its child field objects... - if ( isUnionType( o ) ) { - setPadding( o.fields, padding ); - } - - return fields; -} - - -// EXPORTS // - -module.exports = byteOffsets; diff --git a/lib/casting_modes.js b/lib/casting_modes.js deleted file mode 100644 index f5b55d1..0000000 --- a/lib/casting_modes.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -var CASTING_MODES = [ - 'none', - 'safe', - 'mostly-safe', - 'same-kind', - 'unsafe' -]; - - -// EXPORTS // - -module.exports = CASTING_MODES; diff --git a/lib/complex2boolean.js b/lib/complex2boolean.js deleted file mode 100644 index bcfe273..0000000 --- a/lib/complex2boolean.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Boolean = require( '@stdlib/boolean-ctor' ); - - -// MAIN // - -/** -* Converts a complex number to a boolean. -* -* @private -* @param {ComplexLike} value - input value -* @returns {boolean} result -*/ -function complex2boolean( value ) { - return Boolean( value.re || value.im ); -} - - -// EXPORTS // - -module.exports = complex2boolean; diff --git a/lib/complex2number.js b/lib/complex2number.js deleted file mode 100644 index 92cf949..0000000 --- a/lib/complex2number.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Converts a complex number to a number. -* -* @private -* @param {ComplexLike} value - input value -* @returns {number} result -*/ -function complex2number( value ) { - return value.re; -} - - -// EXPORTS // - -module.exports = complex2number; diff --git a/lib/create_prototype_accessors.js b/lib/create_prototype_accessors.js deleted file mode 100644 index e50842b..0000000 --- a/lib/create_prototype_accessors.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable id-length */ - -'use strict'; - -// MODULES // - -var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' ); -var setNonEnumerableReadWriteAccessor = require( '@stdlib/utils-define-nonenumerable-read-write-accessor' ); -var setReadOnlyAccessor = require( '@stdlib/utils-define-read-only-accessor' ); -var setReadWriteAccessor = require( '@stdlib/utils-define-read-write-accessor' ); -var getter = require( './getter.js' ); -var setter = require( './setter.js' ); - - -// MAIN // - -/** -* Assigns methods for accessing field values to a provided prototype. -* -* @private -* @param {Object} p - prototype -* @param {Array} fields - field objects -* @returns {Object} object containing accessors for each field -*/ -function createPrototypeAccessors( p, fields ) { - var get; - var set; - var out; - var o; - var i; - - out = {}; - for ( i = 0; i < fields.length; i++ ) { - o = fields[ i ]; - get = getter( o ); - set = setter( o ); - if ( o.enumerable ) { - if ( o.writable ) { - setReadWriteAccessor( p, o.name, get, set ); - } else { - setReadOnlyAccessor( p, o.name, get ); - } - } else if ( o.writable ) { - setNonEnumerableReadWriteAccessor( p, o.name, get, set ); - } else { - setNonEnumerableReadOnlyAccessor( p, o.name, get ); - } - out[ o.name ] = [ get, set ]; - } - return out; -} - - -// EXPORTS // - -module.exports = createPrototypeAccessors; diff --git a/lib/ctor_name.js b/lib/ctor_name.js deleted file mode 100644 index 72223f7..0000000 --- a/lib/ctor_name.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -var CTOR_NAME = 'Struct'; - - -// EXPORTS // - -module.exports = CTOR_NAME; diff --git a/lib/data_view_methods.js b/lib/data_view_methods.js deleted file mode 100644 index 1472ad9..0000000 --- a/lib/data_view_methods.js +++ /dev/null @@ -1,89 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -var DATA_VIEW_METHODS = { - 'int8': { - 'get': 'getInt8', - 'set': 'setInt8' - }, - 'int16': { - 'get': 'getInt16', - 'set': 'setInt16' - }, - 'int32': { - 'get': 'getInt32', - 'set': 'setInt32' - }, - 'int64': { - 'get': 'getBigInt64', - 'set': 'setBigInt64' - }, - 'uint8': { - 'get': 'getUint8', - 'set': 'setUint8' - }, - 'uint16': { - 'get': 'getUint16', - 'set': 'setUint16' - }, - 'uint32': { - 'get': 'getUint32', - 'set': 'setUint32' - }, - 'uint64': { - 'get': 'getBigUint64', - 'set': 'setBigUint64' - }, - 'float16': { - 'get': 'getFloat16', - 'set': 'setFloat16' - }, - 'float32': { - 'get': 'getFloat32', - 'set': 'setFloat32' - }, - 'float64': { - 'get': 'getFloat64', - 'set': 'setFloat64' - }, - 'complex32': { - 'get': 'getFloat16', - 'set': 'setFloat16' - }, - 'complex64': { - 'get': 'getFloat32', - 'set': 'setFloat32' - }, - 'complex128': { - 'get': 'getFloat64', - 'set': 'setFloat64' - }, - 'bool': { - 'get': 'getUint8', - 'set': 'setUint8' - } -}; - - -// EXPORTS // - -module.exports = DATA_VIEW_METHODS; diff --git a/lib/defaults.json b/lib/defaults.json deleted file mode 100644 index bd77c61..0000000 --- a/lib/defaults.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dtypes": { - "real": "float64", - "complex": "complex128" - } -} diff --git a/lib/dtypes.js b/lib/dtypes.js deleted file mode 100644 index f78bc9e..0000000 --- a/lib/dtypes.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -var DTYPES = [ - 'int8', - 'int16', - 'int32', - 'int64', - - 'uint8', - 'uint16', - 'uint32', - 'uint64', - - // 'float16', // TODO: uncomment once supported - - 'float32', - 'float64', - - // 'complex32', // TODO: uncomment once supported - - 'complex64', - 'complex128', - - 'bool' -]; - - -// EXPORTS // - -module.exports = DTYPES; diff --git a/lib/field_index.js b/lib/field_index.js deleted file mode 100644 index 7d163ef..0000000 --- a/lib/field_index.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var indexOf = require( '@stdlib/array-base-index-of' ); -var join = require( '@stdlib/array-base-join' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Returns the index of a specified field name in a provided list of field names. -* -* @private -* @param {Array} names - list of field names -* @param {string} name - field name -* @throws {Error} struct must have at least one field -* @throws {TypeError} must provide a recognized field name -* @returns {(integer|Error)} index or an error object -*/ -function fieldIndex( names, name ) { - var idx; - if ( names.length === 0 ) { - return new Error( 'invalid operation. struct does not have any fields.' ); - } - idx = indexOf( names, name, 0 ); - if ( idx < 0 ) { - return new TypeError( format( 'invalid argument. Field name must be one of the following: "%s". Value: `%s`.', join( names, ', ' ), name ) ); - } - return idx; -} - - -// EXPORTS // - -module.exports = fieldIndex; diff --git a/lib/field_names.js b/lib/field_names.js deleted file mode 100644 index c70bede..0000000 --- a/lib/field_names.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string-format' ); -var isUnionType = require( './is_union_type.js' ); - - -// MAIN // - -/** -* Resolves a list of field names. -* -* @private -* @param {Array} fields - list of field objects -* @returns {(Array|Error)} list of field names or an error -*/ -function fieldNames( fields ) { - var hash; - var out; - var o1; - var o2; - var i; - var j; - var k; - - hash = {}; - out = []; - for ( i = 0; i < fields.length; i++ ) { - o1 = fields[ i ]; - k = o1.name; - if ( isUnionType( o1 ) ) { - for ( j = 0; j < o1.fields.length; j++ ) { - o2 = o1.fields[ j ]; - k = o2.name; - if ( hash[ k ] === true ) { - return new TypeError( format( 'invalid argument. First argument must be an array of objects having unique field names. Value: `%s`.', JSON.stringify( fields ) ) ); - } - hash[ k ] = true; - out.push( k ); - } - } else if ( hash[ k ] === true ) { - return new TypeError( format( 'invalid argument. First argument must be an array of objects having unique field names. Value: `%s`.', JSON.stringify( fields ) ) ); - } else { - hash[ k ] = true; - out.push( k ); - } - } - return out; -} - - -// EXPORTS // - -module.exports = fieldNames; diff --git a/lib/field_properties.js b/lib/field_properties.js deleted file mode 100644 index 7c4e487..0000000 --- a/lib/field_properties.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -var FIELD_PROPERTIES = [ - 'name', - 'type', - 'description', - 'length', - 'enumerable', - 'writable', - 'default', - 'castingMode' -]; - - -// EXPORTS // - -module.exports = FIELD_PROPERTIES; diff --git a/lib/flatten_fields.js b/lib/flatten_fields.js deleted file mode 100644 index 6c7c99a..0000000 --- a/lib/flatten_fields.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isUnionType = require( './is_union_type.js' ); - - -// MAIN // - -/** -* Flattens a list of field objects. -* -* @private -* @param {Array} fields - list of field objects -* @returns {Array} new list -*/ -function flatten( fields ) { - var out; - var o; - var i; - var j; - - out = []; - for ( i = 0; i < fields.length; i++ ) { - o = fields[ i ]; - if ( isUnionType( o ) ) { - for ( j = 0; j < o.fields.length; j++ ) { - out.push( o.fields[ j ] ); - } - } else { - out.push( o ); - } - } - return out; -} - - -// EXPORTS // - -module.exports = flatten; diff --git a/lib/format_layout.js b/lib/format_layout.js deleted file mode 100644 index e253ba4..0000000 --- a/lib/format_layout.js +++ /dev/null @@ -1,127 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var replace = require( '@stdlib/string-base-replace' ); -var format = require( '@stdlib/string-format' ); - - -// FUNCTIONS // - -/** -* Returns a new regular expression for matching byte parameters. -* -* @private -* @returns {RegExp} regular expression -*/ -function reByteOffset() { - return /\[(\d{1,}),/g; -} - -/** -* Returns a function for replacing byte values in a serialized struct. -* -* @private -* @param {NonNegativeInteger} offset - byte offset -* @returns {Function} replacer function -*/ -function replacer( offset ) { - return wrapped; - - /** - * Callback invoked for each match. - * - * @private - * @param {string} match - matched substring - * @param {string} p1 - first matched capture group substring - * @returns {string} replacement string - */ - function wrapped( match, p1 ) { - return format( '[%u,', offset+parseInt( p1, 10 ) ); - } -} - - -// MAIN // - -/** -* Serializes a struct to a layout format. -* -* ## Notes -* -* - The output format is a multi-column format having the following layout: -* -* ```text -* | ...[byte_offset,byte_length] | -* ``` -* -* For example, -* -* ```text -* |[0,8]|[8,1]|[16,16]|[32,8]| -* ``` -* -* @private -* @param {Array} fields - list of normalized fields -* @returns {string} string representation -*/ -function layoutFormat( fields ) { - var out; - var tmp; - var re; - var N; - var o; - var i; - - N = fields.length; - - // Create a new regular expression for matching byte offsets: - re = reByteOffset(); - - out = []; - for ( i = 0; i < N; i++ ) { - o = fields[ i ]; - - // If we are currently processing fields in a union, move along to the next non-union field... - if ( i > 0 && ( o.byteOffset === fields[ i-1 ].byteOffset ) ) { - continue; - } - // If the current type is a struct, we need to serialize and then post-process... - if ( o.isStructType ) { - out.push( replace( o.type.layout, re, replacer( o.byteOffset ) ) ); - continue; - } - // Format the field data: - out.push( format( '|<%s>[%u,%u]', o.type, o.byteOffset, o.byteLength ) ); - } - tmp = format( '%s|', out.join( '' ) ); - - // If we having a trailing `||` due to a nested struct, remove the final `|`: - if ( tmp[ tmp.length-2 ] === '|' ) { - tmp = tmp.substring( 0, tmp.length-1 ); - } - return tmp; -} - - -// EXPORTS // - -module.exports = layoutFormat; diff --git a/lib/format_linear.js b/lib/format_linear.js deleted file mode 100644 index 9cd73a4..0000000 --- a/lib/format_linear.js +++ /dev/null @@ -1,181 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var floor = require( '@stdlib/math-base-special-floor' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Serializes a struct to a linear string format. -* -* ## Notes -* -* - The output format is a three-column format having the following layout: -* -* ```text -* | byte_number | [field|padding] | notes | -* ``` -* -* - Nested `struct` instances are intentionally treated as opaque types, as we have limited access to struct internals (e.g., packed versus unpacked, field padding, etc), and we would effectively have to recompute all alignments and associated field data for the purposes of rendering. A user can always separately render a nested `struct` instance to a string in order to better understand its layout independently of its surrounding context in a parent `struct` instance. -* -* @private -* @param {Function} Struct - struct constructor -* @param {Array} fields - list of normalized fields -* @returns {string} string representation -*/ -function linearFormat( Struct, fields ) { - var nbytes; - var fmt0; - var fmt1; - var fmt2; - var bfmt; - var ufmt; - var fmt; - var tmp; - var out; - var flg; - var ib; - var c0; - var c1; - var c2; - var w0; - var w1; - var w; - var N; - var o; - var f; - var t; - var i; - var j; - var k; - - N = fields.length; - - // Resolve the size of the struct: - nbytes = Struct.byteLength; - - // Compute the width of the first column: - w0 = ( nbytes-1 ).toString().length; - - // Define a format string for the first column: - fmt0 = '%'+w0+'s'; - - // Determine the longest field name... - w1 = 0; - for ( i = 0; i < N; i++ ) { - o = fields[ i ]; - - // Format: [] - w = o.name.length + 1 + ( o.byteLength-1 ).toString().length + 1; - if ( w > w1 ) { - w1 = w; - } - } - // Define a format string for the second column: - fmt1 = '%'+w1+'s'; - - // Define a format string for the third column: - fmt2 = '// %s'; - - // Define a format string which combines the columns: - fmt = '%s: %s %s'; - - // Initialize a byte counter: - ib = 0; - - out = []; - for ( i = 0; i < N; i++ ) { - o = fields[ i ]; - - // If we are currently processing fields in a union, move along to the next non-union field... - if ( i > 0 && ( o.byteOffset === fields[ i-1 ].byteOffset ) ) { - continue; - } - // Check whether this field is the first field of a union... - if ( i < N-1 ) { - flg = ( o.byteOffset === fields[ i+1 ].byteOffset ); - } else { - flg = false; - } - for ( j = 0; j < o.byteLength; j++ ) { - // In the first column, render the byte number: - c0 = format( fmt0, ib.toString() ); - - // In the second column, render the field name and the byte number relative to the field: - c1 = format( fmt1, format( '%s[%u]', o.name, j ) ); - - // If a field type spans multiple bytes, render the byte number: - if ( o.alignment > 1 ) { - bfmt = ' (byte %u)'; - } else { - bfmt = ''; - } - // If a field is part of a union, make that explicit: - if ( flg ) { - ufmt = ' => union: %s'; - tmp = []; - k = i + 1; - while ( k < N && o.byteOffset === fields[ k ].byteOffset ) { - f = fields[ k ]; - if ( f.isStructType ) { - t = ''; - } else { - t = f.type; - } - tmp.push( format( '%s<%s>[%u]', f.name, t, j%f.alignment ) ); - k += 1; - } - ufmt = format( ufmt, tmp.join( ', ' ) ); - } else { - ufmt = ''; - } - tmp = format( bfmt+ufmt, j%o.alignment ); - - // If a field contains multiple elements (i.e., is an array), render the field type along with the element number: - if ( o.length ) { - c2 = format( fmt2, format( '%s[%u]%s', o.type, floor( j/o.alignment ), tmp ) ); - } - // Otherwise, just render the field type: - else { - c2 = format( fmt2, format( '%s%s', o.type, tmp ) ); - } - // Render the row string: - out.push( format( fmt, c0, c1, c2 ) ); - ib += 1; - } - for ( j = 0; j < o.padding; j++ ) { - c0 = format( fmt0, ib.toString() ); - c1 = format( fmt1, '--' ); - c2 = format( fmt2, 'padding' ); - out.push( format( fmt, c0, c1, c2 ) ); - ib += 1; - } - } - return out.join( '\n' ); -} - - -// EXPORTS // - -module.exports = linearFormat; diff --git a/lib/get_bigint.js b/lib/get_bigint.js deleted file mode 100644 index 9cbdd1f..0000000 --- a/lib/get_bigint.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for resolving field data -*/ -function getBigInt( obj, method ) { - return getter; - - /** - * Reads a BigInt value from an underlying byte buffer. - * - * @private - * @returns {BigInt} result - */ - function getter() { - var view = this[ PRIVATE_BUFFER ]; - return view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN ); - } -} - - -// EXPORTS // - -module.exports = getBigInt; diff --git a/lib/get_boolean.js b/lib/get_boolean.js deleted file mode 100644 index 49cb9e7..0000000 --- a/lib/get_boolean.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for resolving field data -*/ -function getBoolean( obj, method ) { - return getter; - - /** - * Reads a boolean value from an underlying byte buffer. - * - * @private - * @returns {boolean} result - */ - function getter() { - var view = this[ PRIVATE_BUFFER ]; - return Boolean( view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN ) ); - } -} - - -// EXPORTS // - -module.exports = getBoolean; diff --git a/lib/get_complex.js b/lib/get_complex.js deleted file mode 100644 index ea97cb9..0000000 --- a/lib/get_complex.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this, max-len */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var complex = require( '@stdlib/complex-cmplx' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// VARIABLES // - -var CMPLX_TO_REAL = { - 'complex128': 'float64', - 'complex64': 'float32', - 'complex32': 'float16' -}; - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for resolving field data -*/ -function getComplex( obj, method ) { - return getter; - - /** - * Reads a complex number from an underlying byte buffer. - * - * @private - * @returns {Complex} result - */ - function getter() { - var view = this[ PRIVATE_BUFFER ]; - var re = view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN ); - var im = view[ method ]( obj.byteOffset+(obj.byteLength/2), IS_LITTLE_ENDIAN ); - return complex( re, im, CMPLX_TO_REAL[ obj.type ] ); - } -} - - -// EXPORTS // - -module.exports = getComplex; diff --git a/lib/get_number.js b/lib/get_number.js deleted file mode 100644 index 454ae92..0000000 --- a/lib/get_number.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for resolving field data -*/ -function getNumber( obj, method ) { - return getter; - - /** - * Reads a number value from an underlying byte buffer. - * - * @private - * @returns {number} result - */ - function getter() { - var view = this[ PRIVATE_BUFFER ]; - return view[ method ]( obj.byteOffset, IS_LITTLE_ENDIAN ); - } -} - - -// EXPORTS // - -module.exports = getNumber; diff --git a/lib/get_struct.js b/lib/get_struct.js deleted file mode 100644 index 9809d30..0000000 --- a/lib/get_struct.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @returns {Function} function for resolving field data -*/ -function getStruct( obj ) { - return getter; - - /** - * Returns a `struct` view of an underlying byte buffer. - * - * @private - * @returns {Object} result - */ - function getter() { - var view = this[ PRIVATE_BUFFER ]; - return new obj.type( view.buffer, view.byteOffset+obj.byteOffset, obj.byteLength ); // eslint-disable-line max-len - } -} - - -// EXPORTS // - -module.exports = getStruct; diff --git a/lib/get_struct_array.js b/lib/get_struct_array.js deleted file mode 100644 index e77507f..0000000 --- a/lib/get_struct_array.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @returns {Function} function for resolving field data -*/ -function getStructArray( obj ) { - return getter; - - /** - * Returns a list of `struct` views of an underlying byte buffer. - * - * @private - * @returns {Array} result - */ - function getter() { - var offset; - var view; - var out; - var i; - - view = this[ PRIVATE_BUFFER ]; - offset = view.byteOffset + obj.byteOffset; - out = []; - for ( i = 0; i < obj.length; i++ ) { - out.push( new obj.type( view.buffer, offset, obj.byteLength ) ); - offset += obj.byteOffset; - } - return out; - } -} - - -// EXPORTS // - -module.exports = getStructArray; diff --git a/lib/get_typedarray.js b/lib/get_typedarray.js deleted file mode 100644 index 3fbe534..0000000 --- a/lib/get_typedarray.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var typedarray = require( '@stdlib/array-typed' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @returns {Function} function for resolving field data -*/ -function getTypedArray( obj ) { - return getter; - - /** - * Returns a typed array view of an underlying byte buffer. - * - * @private - * @returns {TypedArray} result - */ - function getter() { - var view = this[ PRIVATE_BUFFER ]; - return typedarray( view.buffer, view.byteOffset+obj.byteOffset, obj.length, obj.type ); // eslint-disable-line max-len - } -} - - -// EXPORTS // - -module.exports = getTypedArray; diff --git a/lib/getter.js b/lib/getter.js deleted file mode 100644 index 581a5bd..0000000 --- a/lib/getter.js +++ /dev/null @@ -1,87 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string-format' ); -var DATA_VIEW_METHODS = require( './data_view_methods.js' ); -var getNumber = require( './get_number.js' ); -var getBoolean = require( './get_boolean.js' ); -var getComplex = require( './get_complex.js' ); -var getBigInt = require( './get_bigint.js' ); -var getStruct = require( './get_struct.js' ); -var getTypedArray = require( './get_typedarray.js' ); -var getStructArray = require( './get_struct_array.js' ); - - -// MAIN // - -/** -* Returns a function for resolving field data. -* -* @private -* @param {Object} obj - field object -* @throws {Error} unexpected error -* @returns {Function} function for resolving field data -*/ -function getter( obj ) { - if ( obj.length ) { - if ( obj.isStructType ) { - return getStructArray( obj ); - } - return getTypedArray( obj ); - } - switch ( obj.type ) { - case 'float64': - case 'float32': - case 'float16': - case 'int8': - case 'int16': - case 'int32': - case 'uint8': - case 'uint16': - case 'uint32': - return getNumber( obj, DATA_VIEW_METHODS[ obj.type ].get ); - - case 'int64': - case 'uint64': - return getBigInt( obj, DATA_VIEW_METHODS[ obj.type ].get ); - - case 'bool': - return getBoolean( obj, DATA_VIEW_METHODS[ obj.type ].get ); - - case 'complex128': - case 'complex64': - case 'complex32': - return getComplex( obj, DATA_VIEW_METHODS[ obj.type ].get ); - - default: - if ( obj.isStructType ) { - return getStruct( obj ); - } - // Ensure that we fail loudly if we have failed to add support for newly added data types: - throw new Error( format( 'unexpected error. Unrecognized data type. Value: `%s`.', obj.type ) ); - } -} - - -// EXPORTS // - -module.exports = getter; diff --git a/lib/has_properties.js b/lib/has_properties.js deleted file mode 100644 index 4efa706..0000000 --- a/lib/has_properties.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var hasProp = require( '@stdlib/assert-has-property' ); - - -// MAIN // - -/** -* Tests whether an object has a list of properties. -* -* @private -* @param {Object} obj - input object -* @param {Array} keys - list of property names -* @returns {boolean} result -*/ -function hasProperties( obj, keys ) { - var i; - for ( i = 0; i < keys.length; i++ ) { - if ( !hasProp( obj, keys[ i ] ) ) { - return false; - } - } - return true; -} - - -// EXPORTS // - -module.exports = hasProperties; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 66b138b..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Create a constructor for creating a fixed-width composite data type (a.k.a., a `struct`). -* -* @module @stdlib/dstructs-struct -* -* @example -* var factory = require( '@stdlib/dstructs-struct' ); -* -* var fields = [ -* { -* 'type': 'union', -* 'fields': [ -* { -* 'name': 'double', -* 'description': 'double-precision floating-point number', -* 'type': 'float64', -* 'enumerable': true, -* 'writable': true, -* 'castingMode': 'none' -* }, -* { -* 'name': 'words', -* 'description': 'high and low words', -* 'type': 'uint32', -* 'length': 2, -* 'enumerable': true, -* 'writable': true, -* 'castingMode': 'none' -* } -* ] -* } -* ]; -* var Struct = factory( fields ); -* -* var data = { -* 'double': 3.14 -* }; -* var s = new Struct( data ); -* // returns -* -* var v = s.double; -* // returns 3.14 -* -* var w = s.words; -* // e.g., [ 1374389535, 1074339512 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/init_field_object.js b/lib/init_field_object.js deleted file mode 100644 index f27784d..0000000 --- a/lib/init_field_object.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Returns an initialized field object. -* -* @private -* @returns {Object} initialized field object -*/ -function initFieldObject() { - return { - 'isStructType': false, - 'description': '', - 'byteLength': 0, - 'byteOffset': 0, - 'alignment': 0, - 'padding': 0, - 'enumerable': true, - 'writable': true, - 'default': void 0, // explicitly set to `undefined` - 'castingMode': 'none' - }; -} - - -// EXPORTS // - -module.exports = initFieldObject; diff --git a/lib/is_struct_instance.js b/lib/is_struct_instance.js deleted file mode 100644 index 45867e0..0000000 --- a/lib/is_struct_instance.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isDataView = require( '@stdlib/assert-is-dataview' ); -var isObject = require( '@stdlib/assert-is-object' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a boolean indicating if a value is a `struct` instance. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating if a value is a `struct` instance -*/ -function isStructInstance( value ) { - // NOTE: the following is a relatively weak test, but we cannot use `instanceof` checks, etc, due to the factory nature of the implementation. Regardless, here, we are just trying to sniff out a `struct` type. If calling as a constructor later fails, we punt the responsibility off to the user to handle what should be an edge case. If, in the future, this check proves insufficient, we can add further "brand" checks... - return ( - isObject( value ) && - isDataView( value[ PRIVATE_BUFFER ] ) - ); -} - - -// EXPORTS // - -module.exports = isStructInstance; diff --git a/lib/is_union_type.js b/lib/is_union_type.js deleted file mode 100644 index 0230e40..0000000 --- a/lib/is_union_type.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isCollection = require( '@stdlib/assert-is-collection' ); - - -// MAIN // - -/** -* Returns a boolean indicating whether a field object represents a union type. -* -* @private -* @param {Object} obj - input field object -* @returns {boolean} result -*/ -function isUnionType( obj ) { - return obj.type === 'union' && isCollection( obj.fields ); -} - - -// EXPORTS // - -module.exports = isUnionType; diff --git a/lib/is_valid_boolean.js b/lib/is_valid_boolean.js deleted file mode 100644 index 120b1f0..0000000 --- a/lib/is_valid_boolean.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Tests whether a provided value is a valid boolean field. -* -* @private -* @param {*} value - input value -* @param {string} name - field name -* @returns {(null|TypeError)} error object or null -*/ -function isValidBoolean( value, name ) { - if ( isBoolean( value ) ) { - return null; - } - return new TypeError( format( 'invalid argument. `%s` field must be a boolean. Value: `%s`.', name, value ) ); -} - - -// EXPORTS // - -module.exports = isValidBoolean; diff --git a/lib/is_valid_nonempty_string.js b/lib/is_valid_nonempty_string.js deleted file mode 100644 index 03dae5e..0000000 --- a/lib/is_valid_nonempty_string.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Tests whether a provided value is a valid string field. -* -* @private -* @param {*} value - input value -* @param {string} name - field name -* @returns {(null|TypeError)} error object or null -*/ -function isValidNonEmptyString( value, name ) { - if ( isString( value ) || value.length > 0 ) { - return null; - } - return new TypeError( format( 'invalid argument. `%s` field must be a non-empty string. Value: `%s`.', name, value ) ); -} - - -// EXPORTS // - -module.exports = isValidNonEmptyString; diff --git a/lib/is_valid_one_of.js b/lib/is_valid_one_of.js deleted file mode 100644 index 3757784..0000000 --- a/lib/is_valid_one_of.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var contains = require( '@stdlib/array-base-assert-contains' ); -var join = require( '@stdlib/array-base-join' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Returns a function for testing whether a provided value is a valid enumerated field. -* -* @private -* @param {Collection} values - list of possible values -* @returns {Function} output function -*/ -function isValidOneOf( values ) { - return isValid; - - /** - * Tests whether a provided value is a valid enumerated field. - * - * @private - * @param {*} value - input value - * @param {string} name - field name - * @returns {(null|TypeError)} error object or null - */ - function isValid( value, name ) { - if ( contains( values, value ) ) { - return null; - } - return new TypeError( format( 'invalid argument. `%s` field must be one of the following: "%s". Value: `%s`.', name, join( values, ', ' ), value ) ); - } -} - - -// EXPORTS // - -module.exports = isValidOneOf; diff --git a/lib/is_valid_positive_integer.js b/lib/is_valid_positive_integer.js deleted file mode 100644 index 50d22af..0000000 --- a/lib/is_valid_positive_integer.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Tests whether a provided value is a valid positive integer field. -* -* @private -* @param {*} value - input value -* @param {string} name - field name -* @returns {(null|TypeError)} error object or null -*/ -function isValidPositiveInteger( value, name ) { - if ( isPositiveInteger( value ) ) { - return null; - } - return new TypeError( format( 'invalid argument. `%s` field must be a positive integer. Value: `%s`.', name, value ) ); -} - - -// EXPORTS // - -module.exports = isValidPositiveInteger; diff --git a/lib/is_valid_string.js b/lib/is_valid_string.js deleted file mode 100644 index 642d2e2..0000000 --- a/lib/is_valid_string.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Tests whether a provided value is a valid string field. -* -* @private -* @param {*} value - input value -* @param {string} name - field name -* @returns {(null|TypeError)} error object or null -*/ -function isValidString( value, name ) { - if ( isString( value ) ) { - return null; - } - return new TypeError( format( 'invalid argument. `%s` field must be a string. Value: `%s`.', name, value ) ); -} - - -// EXPORTS // - -module.exports = isValidString; diff --git a/lib/is_valid_type.js b/lib/is_valid_type.js deleted file mode 100644 index 10f7b24..0000000 --- a/lib/is_valid_type.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' ); -var contains = require( '@stdlib/array-base-assert-contains' ); -var join = require( '@stdlib/array-base-join' ); -var format = require( '@stdlib/string-format' ); -var DTYPES = require( './dtypes.js' ); - - -// MAIN // - -/** -* Tests whether a provided value is a valid `type` field. -* -* @private -* @param {*} value - input value -* @returns {(null|TypeError)} error object or null -*/ -function isValidType( value ) { - if ( contains( DTYPES, value ) || isStructConstructorLike( value ) ) { - return null; - } - return new TypeError( format( 'invalid argument. `%s` field must be either a struct type or one of the following: "%s". Value: `%s`.', 'type', join( DTYPES, ', ' ), value ) ); -} - - -// EXPORTS // - -module.exports = isValidType; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 80fa7af..0000000 --- a/lib/main.js +++ /dev/null @@ -1,523 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-restricted-syntax, id-length, no-invalid-this */ - -'use strict'; - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' ); -var isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var isCollection = require( '@stdlib/assert-is-collection' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isObject = require( '@stdlib/assert-is-object' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var min = require( '@stdlib/math-base-special-fast-min' ); -var filled = require( '@stdlib/array-base-filled' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var DataView = require( '@stdlib/array-dataview' ); -var format = require( '@stdlib/string-format' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); -var CTOR_NAME = require( './ctor_name.js' ); -var createPrototypeAccessors = require( './create_prototype_accessors.js' ); -var isStructInstance = require( './is_struct_instance.js' ); -var normalize = require( './normalize_field_list.js' ); -var fieldNames = require( './field_names.js' ); -var fieldIndex = require( './field_index.js' ); -var resolveAlignment = require( './resolve_alignment.js' ); -var byteOffsets = require( './byte_offsets.js' ); -var partitions = require( './partitions.js' ); -var flatten = require( './flatten_fields.js' ); -var struct2string = require( './to_string.js' ); -var struct2json = require( './to_json.js' ); -var layoutFormat = require( './format_layout.js' ); - - -// MAIN // - -/** -* Returns a constructor for creating a fixed-width composite data type (a.k.a., a `struct`). -* -* @param {ObjectArray} fields - structure fields -* @throws {TypeError} first argument must be an array-like object containing objects -* @throws {TypeError} field objects must have required properties -* @throws {TypeError} field objects must have valid fields -* @throws {TypeError} union types must be array-like objects containing objects -* @throws {RangeError} union types must contain fields having the same byte length -* @throws {TypeError} union types cannot contain nested union types -* @throws {TypeError} union types can only contain one field with a default value -* @throws {Error} unexpected error -* @returns {Function} constructor -* -* @example -* var fields = [ -* { -* 'type': 'union', -* 'fields': [ -* { -* 'name': 'double', -* 'description': 'double-precision floating-point number', -* 'type': 'float64', -* 'enumerable': true, -* 'writable': true, -* 'castingMode': 'none' -* }, -* { -* 'name': 'words', -* 'description': 'high and low words', -* 'type': 'uint32', -* 'length': 2, -* 'enumerable': true, -* 'writable': true, -* 'castingMode': 'none' -* } -* ] -* } -* ]; -* var Struct = factory( fields ); -* -* var data = { -* 'double': 3.14 -* }; -* var s = new Struct( data ); -* // returns -* -* var v = s.double; -* // returns 3.14 -* -* var w = s.words; -* // e.g., [ 1374389535, 1074339512 ] -*/ -function factory( fields ) { - var FIELD_NAMES; - var BYTE_LENGTH; - var PARTITIONS; - var ALIGNMENT; - var ACCESSORS; - var FIELDS; - var tmp; - var o; - if ( !isCollection( fields ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', fields ) ); - } - // Normalize the list of field objects: - tmp = normalize( fields ); - if ( tmp instanceof Error ) { - throw tmp; - } - FIELDS = tmp; - - // Resolve the list of unique field names: - tmp = fieldNames( FIELDS ); - if ( tmp instanceof Error ) { - throw tmp; - } - FIELD_NAMES = tmp; - - // Resolve the struct's alignment requirements: - ALIGNMENT = resolveAlignment( FIELDS ); - - // Compute the byte offset for each field: - FIELDS = byteOffsets( FIELDS, ALIGNMENT ); - - // Now that we've finished processing provided field objects, flatten the list, such that union types are implied by field objects having the same byte offset: - FIELDS = flatten( FIELDS ); - - // Compute field "partitions" (i.e., non-overlapping views): - PARTITIONS = partitions( FIELDS ); - - // Compute the struct's byte length: - o = FIELDS[ FIELDS.length-1 ]; - BYTE_LENGTH = o.byteOffset + o.byteLength + o.padding; - - /** - * Constructor for a composite data type (a.k.a., a `struct`). - * - * @private - * @param {(Object|ArrayBuffer)} [arg] - array buffer or data object - * @param {NonNegativeInteger} [byteOffset=0] - offset, in bytes, to the first byte in a provided buffer for the returned `struct` to reference - * @param {NonNegativeInteger} [byteLength] - maximum number of elements in the byte array - * @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements - * @throws {TypeError} second argument must be a nonnegative integer - * @throws {TypeError} third argument must be a nonnegative integer - * @throws {Error} union types may only be initialized by a single member - * @returns {Struct} struct instance - */ - function Struct( arg, byteOffset, byteLength ) { - var values; - var nargs; - var cache; - var view; - var obj; - var o; - var v; - var i; - var j; - var k; - - nargs = arguments.length; - if ( !( this instanceof Struct ) ) { - if ( nargs === 0 ) { - return new Struct(); - } - if ( nargs === 1 ) { - return new Struct( arg ); - } - if ( nargs === 2 ) { - return new Struct( arg, byteOffset ); - } - return new Struct( arg, byteOffset, byteLength ); - } - if ( isArrayBuffer( arg ) ) { - if ( nargs === 1 ) { - view = new DataView( arg, 0, BYTE_LENGTH ); - } else { - if ( !isNonNegativeInteger( byteOffset ) ) { - throw new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) ); - } - if ( nargs === 2 ) { - view = new DataView( arg, byteOffset, BYTE_LENGTH ); - } else { - if ( !isNonNegativeInteger( byteLength ) ) { - throw new TypeError( format( 'invalid argument. Byte length must be a nonnegative integer. Value: `%s`.', byteLength ) ); - } - view = new DataView( arg, byteOffset, min( byteLength, BYTE_LENGTH ) ); // eslint-disable-line max-len - } - } - if ( view.byteLength < BYTE_LENGTH ) { - throw new RangeError( format( 'invalid argument. ArrayBuffer has insufficient capacity. Minimum capacity: `%u`.', BYTE_LENGTH ) ); - } - } else { - view = new DataView( new ArrayBuffer( BYTE_LENGTH ) ); - if ( nargs > 0 ) { - if ( !isObject( arg ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', arg ) ); - } - obj = arg; - } - } - // Bind the byte buffer to the current instance: - setReadOnly( this, PRIVATE_BUFFER, view ); - - // If we were provided a data object, set provided fields... - if ( obj !== void 0 ) { - // Initialize an array containing values to set: - values = filled( void 0, FIELDS.length ); - - // For each field, determine whether a value has been specified... - cache = {}; - for ( i = 0; i < FIELDS.length; i++ ) { - k = FIELD_NAMES[ i ]; - j = PARTITIONS[ i ]; - if ( hasProp( obj, k ) ) { - // Check whether a value has already been specified for this view (i.e., via another union member)... - if ( cache[ j ] ) { - throw new Error( 'invalid argument. Union types may only be initialized by a single member.' ); - } - values[ i ] = obj[ k ]; - cache[ j ] = true; - } - } - // Perform a second pass over the fields to fill in default initial values... - for ( i = 0; i < FIELDS.length; i++ ) { - j = PARTITIONS[ i ]; - if ( cache[ j ] ) { - // Skip fields already having initial values... - continue; - } - o = FIELDS[ i ]; - if ( o.default !== void 0 ) { - values[ i ] = o.default; - } - } - // Set all fields with initialization values... - for ( i = 0; i < FIELDS.length; i++ ) { - v = values[ i ]; - if ( v !== void 0 ) { - ACCESSORS[ FIELD_NAMES[ i ] ][ 1 ].call( this, v ); - } - } - } - return this; - } - - /** - * Constructor name. - * - * @private - * @name name - * @memberof Struct - * @readonly - * @type {string} - * @default 'Struct' - */ - setReadOnly( Struct, 'name', CTOR_NAME ); - - /** - * Alignment. - * - * @private - * @name alignment - * @memberof Struct - * @readonly - * @type {PositiveInteger} - */ - setReadOnly( Struct, 'alignment', ALIGNMENT ); - - /** - * Size (in bytes) of the `struct`. - * - * @private - * @name byteLength - * @memberof Struct - * @readonly - * @type {PositiveInteger} - */ - setReadOnly( Struct, 'byteLength', BYTE_LENGTH ); - - /** - * Returns a list of `struct` fields. - * - * @private - * @name fields - * @memberof Struct - * @readonly - * @type {Array} - */ - setNonEnumerableReadOnlyAccessor( Struct, 'fields', function get() { - return FIELD_NAMES.slice(); - }); - - /** - * Returns a string corresponding to the `struct` layout. - * - * @private - * @name layout - * @memberof Struct - * @readonly - * @type {string} - */ - setNonEnumerableReadOnlyAccessor( Struct, 'layout', function get() { - // As this is not likely to be a commonly used API, intentionally recompute the layout format in order to avoid consuming memory for what could be a long string... - return layoutFormat( FIELDS ); - }); - - /** - * Returns the underlying byte buffer of a `struct`. - * - * @private - * @name bufferOf - * @memberof Struct - * @readonly - * @type {Function} - * @param {Object} obj - struct instance - * @throws {TypeError} must provide a `struct` instance - * @returns {ArrayBuffer} underlying byte buffer - */ - setReadOnly( Struct, 'bufferOf', function bufferOf( obj ) { - if ( !isStructInstance( obj ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a `struct` instance. Value: `%s`.', obj ) ); - } - return obj[ PRIVATE_BUFFER ].buffer; - }); - - /** - * Returns the length, in bytes, of the value specified by the provided field name. - * - * @private - * @name byteLengthOf - * @memberof Struct - * @readonly - * @type {Function} - * @param {string} name - field name - * @throws {Error} struct must have at least one field - * @throws {TypeError} must provide a recognized field name - * @returns {NonNegativeInteger} byte length - */ - setReadOnly( Struct, 'byteLengthOf', function byteLengthOf( name ) { - var idx = fieldIndex( FIELD_NAMES, name ); - if ( idx instanceof Error ) { - throw idx; - } - return FIELDS[ idx ].byteLength; - }); - - /** - * Returns the offset, in bytes, from the beginning of a `struct` to the value specified by the provided field name. - * - * @private - * @name byteOffsetOf - * @memberof Struct - * @readonly - * @type {Function} - * @param {string} name - field name - * @throws {Error} struct must have at least one field - * @throws {TypeError} must provide a recognized field name - * @returns {NonNegativeInteger} byte offset - */ - setReadOnly( Struct, 'byteOffsetOf', function byteOffsetOf( name ) { - var idx = fieldIndex( FIELD_NAMES, name ); - if ( idx instanceof Error ) { - throw idx; - } - return FIELDS[ idx ].byteOffset; - }); - - /** - * Returns the description associated with a provided field name. - * - * @private - * @name descriptionOf - * @memberof Struct - * @readonly - * @type {Function} - * @param {string} name - field name - * @throws {Error} struct must have at least one field - * @throws {TypeError} must provide a recognized field name - * @returns {string} description - */ - setReadOnly( Struct, 'descriptionOf', function descriptionOf( name ) { - var idx = fieldIndex( FIELD_NAMES, name ); - if ( idx instanceof Error ) { - throw idx; - } - return FIELDS[ idx ].description; - }); - - /** - * Returns a boolean indicating whether a provided value is a `struct` instance. - * - * @private - * @name isStruct - * @memberof Struct - * @readonly - * @type {Function} - * @param {*} value - input value - * @returns {boolean} boolean indicating whether a value is a `struct` instance - */ - setReadOnly( Struct, 'isStruct', function isStruct( value ) { - return ( - value instanceof Struct || - ( - isStructInstance( value ) && - isStructConstructorLike( value.constructor ) - ) - ); - }); - - /** - * Returns the type associated with a provided field name. - * - * @private - * @name typeOf - * @memberof Struct - * @readonly - * @type {Function} - * @param {string} name - field name - * @throws {Error} struct must have at least one field - * @throws {TypeError} must provide a recognized field name - * @returns {(string|Object)} type - */ - setReadOnly( Struct, 'typeOf', function typeOf( name ) { - var idx = fieldIndex( FIELD_NAMES, name ); - if ( idx instanceof Error ) { - throw idx; - } - return FIELDS[ idx ].type; - }); - - /** - * Returns the underlying byte buffer of a `struct` as a `DataView`. - * - * @private - * @name viewOf - * @memberof Struct - * @readonly - * @type {Function} - * @param {Object} obj - struct instance - * @throws {TypeError} must provide a `struct` instance - * @returns {DataView} view of underlying byte buffer - */ - setReadOnly( Struct, 'viewOf', function viewOf( obj ) { - var buf; - if ( !isStructInstance( obj ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a `struct` instance. Value: `%s`.', obj ) ); - } - buf = obj[ PRIVATE_BUFFER ]; - return new DataView( buf.buffer, buf.byteOffset, buf.byteLength ); - }); - - // Create prototype accessors for getting and setting field values: - ACCESSORS = createPrototypeAccessors( Struct.prototype, FIELDS ); - - /** - * Serializes a `struct` to a string. - * - * @private - * @name toString - * @memberof Struct.prototype - * @readonly - * @type {Function} - * @param {Options} [options] - function options - * @param {string} [options.format='none'] - serialization format - * @throws {Error} `this` must be a struct instance - * @throws {TypeError} options argument must be an object - * @throws {TypeError} must provide valid options - * @returns {string} serialized `struct` instance - */ - setReadOnly( Struct.prototype, 'toString', function toString() { - var opts; - if ( !( this instanceof Struct ) ) { - throw new Error( 'invalid invocation. `this` is not a struct instance.' ); - } - if ( arguments.length > 0 ) { - opts = arguments[ 0 ]; - } else { - opts = {}; - } - return struct2string( Struct, FIELDS, opts ); - }); - - /** - * Serializes a `struct` to JSON. - * - * @private - * @name toJSON - * @memberof Struct.prototype - * @readonly - * @type {Function} - * @throws {Error} `this` must be a struct instance - * @returns {JSON} serialized `struct` instance - */ - setReadOnly( Struct.prototype, 'toJSON', function toJSON() { - if ( !( this instanceof Struct ) ) { - throw new Error( 'invalid invocation. `this` is not a struct instance.' ); - } - return struct2json( this, FIELDS ); - }); - - return Struct; -} - - -// EXPORTS // - -module.exports = factory; diff --git a/lib/normalize_field.js b/lib/normalize_field.js deleted file mode 100644 index c38acba..0000000 --- a/lib/normalize_field.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isStructConstructorLike = require( '@stdlib/assert-is-struct-constructor-like' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var join = require( '@stdlib/array-base-join' ); -var constantFunction = require( '@stdlib/utils-constant-function' ); -var format = require( '@stdlib/string-format' ); -var hasProperties = require( './has_properties.js' ); -var isValidNonEmptyString = require( './is_valid_nonempty_string.js' ); -var isValidString = require( './is_valid_string.js' ); -var isValidPositiveInteger = require( './is_valid_positive_integer.js' ); -var isValidBoolean = require( './is_valid_boolean.js' ); -var isValidType = require( './is_valid_type.js' ); -var isValidOneOf = require( './is_valid_one_of.js' ); -var initFieldObject = require( './init_field_object.js' ); -var byteLength = require( './byte_length.js' ); -var CASTING_MODES = require( './casting_modes.js' ); -var ALIGNMENTS = require( './alignments.js' ); - - -// VARIABLES // - -var MANDATORY_FIELD_NAMES = [ - 'name', - 'type' -]; - -var VALIDATORS = { - 'name': isValidNonEmptyString, - 'type': isValidType, - 'description': isValidString, - 'length': isValidPositiveInteger, - 'enumerable': isValidBoolean, - 'writable': isValidBoolean, - 'default': constantFunction( null ), - 'castingMode': isValidOneOf( CASTING_MODES ) -}; - - -// MAIN // - -/** -* Normalizes a provided field object. -* -* @private -* @param {Object} obj - input field object -* @param {Array} keys - list of keys to standardize -* @returns {(Object|Error)} output object or an error -*/ -function normalize( obj, keys ) { - var out; - var err; - var v; - var k; - var i; - - out = initFieldObject(); - for ( i = 0; i < keys.length; i++ ) { - k = keys[ i ]; - if ( hasProp( obj, k ) ) { - v = obj[ k ]; - err = VALIDATORS[ k ]( v, k ); - if ( err ) { - return err; - } - out[ k ] = v; - } - } - if ( !hasProperties( out, MANDATORY_FIELD_NAMES ) ) { - return new TypeError( format( 'invalid argument. Field objects must have the following properties: "%s". Value: `%s`.', join( MANDATORY_FIELD_NAMES, ', ' ), JSON.stringify( obj ) ) ); - } - out.isStructType = isStructConstructorLike( out.type ); - out.byteLength = byteLength( out ); - if ( out.isStructType ) { - out.alignment = out.type.alignment; - } else { - out.alignment = ALIGNMENTS[ out.type ]; - } - return out; -} - - -// EXPORTS // - -module.exports = normalize; diff --git a/lib/normalize_field_list.js b/lib/normalize_field_list.js deleted file mode 100644 index e0909bc..0000000 --- a/lib/normalize_field_list.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isObject = require( '@stdlib/assert-is-object' ); -var format = require( '@stdlib/string-format' ); -var FIELD_PROPERTIES = require( './field_properties.js' ); -var isUnionType = require( './is_union_type.js' ); -var normalizeField = require( './normalize_field.js' ); -var normalizeUnion = require( './normalize_union.js' ); - - -// MAIN // - -/** -* Normalizes a list of field objects. -* -* @private -* @param {Array} fields - input fields -* @returns {(Array|Error)} normalized field objects or an error -*/ -function normalize( fields ) { - var out; - var tmp; - var o; - var i; - - out = []; - for ( i = 0; i < fields.length; i++ ) { - o = fields[ i ]; - if ( !isObject( o ) ) { - return new TypeError( format( 'invalid argument. First argument must be an array of objects. Value: `%s`. Index: `%d`.', o, i ) ); - } - // Check for a union type which is a collection of nested field objects which all have the same byte length... - if ( isUnionType( o ) ) { - tmp = normalizeUnion( o ); - if ( tmp === null ) { - return new TypeError( format( 'invalid argument. Union types must be an array of objects. Value: `%s`. Index: `%d`.', JSON.stringify( o ), i ) ); - } - if ( tmp instanceof Error ) { - return tmp; - } - } else { - tmp = normalizeField( o, FIELD_PROPERTIES ); - if ( tmp instanceof Error ) { - return tmp; - } - } - out.push( tmp ); - } - return out; -} - - -// EXPORTS // - -module.exports = normalize; diff --git a/lib/normalize_union.js b/lib/normalize_union.js deleted file mode 100644 index c4ecd7e..0000000 --- a/lib/normalize_union.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isObject = require( '@stdlib/assert-is-object' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var format = require( '@stdlib/string-format' ); -var isUnionType = require( './is_union_type.js' ); -var FIELD_PROPERTIES = require( './field_properties.js' ); -var normalizeField = require( './normalize_field.js' ); -var resolveAlignment = require( './resolve_alignment.js' ); - - -// MAIN // - -/** -* Normalizes a field object representing a union type. -* -* @private -* @param {Object} obj - input field object -* @returns {(Object|null|Error)} normalized field object or error object -*/ -function normalizeUnion( obj ) { - var fields; - var dflg; - var out; - var tmp; - var len; - var o; - var i; - - fields = obj.fields; - if ( fields.length === 0 ) { - return null; - } - out = []; - for ( i = 0; i < fields.length; i++ ) { - o = fields[ i ]; - if ( !isObject( o ) ) { - return null; - } - if ( isUnionType( o ) ) { - return new TypeError( format( 'invalid argument. Union types cannot contain nested union types. Value: `%s`.', JSON.stringify( fields ) ) ); - } - if ( dflg === void 0 && hasProp( o, 'default' ) ) { - dflg = true; - } else if ( dflg === true && hasProp( o, 'default' ) ) { - return new TypeError( format( 'invalid argument. Union types can only contain one field with a default value. Value: `%s`.', JSON.stringify( fields ) ) ); - } - tmp = normalizeField( o, FIELD_PROPERTIES ); - if ( tmp instanceof Error ) { - return tmp; - } - if ( i === 0 ) { - len = tmp.byteLength; - } else if ( tmp.byteLength !== len ) { - return new RangeError( format( 'invalid argument. Union types must contain fields having the same byte length. Value: `%s`.', JSON.stringify( fields ) ) ); - } - out.push( tmp ); - } - return { - 'type': 'union', - 'fields': out, - 'byteLength': len, - 'byteOffset': 0, - 'alignment': resolveAlignment( out ), - 'padding': 0 - }; -} - - -// EXPORTS // - -module.exports = normalizeUnion; diff --git a/lib/number2boolean.js b/lib/number2boolean.js deleted file mode 100644 index f64b67b..0000000 --- a/lib/number2boolean.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Boolean = require( '@stdlib/boolean-ctor' ); - - -// MAIN // - -/** -* Converts a number to a boolean. -* -* @private -* @param {number} value - input value -* @returns {boolean} result -*/ -function number2boolean( value ) { - return Boolean( value ); -} - - -// EXPORTS // - -module.exports = number2boolean; diff --git a/lib/partitions.js b/lib/partitions.js deleted file mode 100644 index dc63618..0000000 --- a/lib/partitions.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Returns a list of partition indices. -* -* ## Notes -* -* - This function partitions field objects according to whether a field object represents a unique "view" over an underlying byte buffer. Field objects within a union belong to the same partition. -* -* @private -* @param {Array} fields - list of normalized field objects -* @returns {NonNegativeIntegerArray} list of indices -*/ -function partitions( fields ) { - var out; - var N; - var o; - var i; - var j; - - N = fields.length; - - out = []; - j = 0; - for ( i = 0; i < N-1; i++ ) { - o = fields[ i ]; - - // Check for the start of a union... - if ( o.byteOffset === fields[ i+1 ].byteOffset ) { - out.push( j ); - continue; - } - out.push( j ); - j += 1; - } - // Set the partition for the last field object: - out.push( j ); - - return out; -} - - -// EXPORTS // - -module.exports = partitions; diff --git a/lib/private_buffer.js b/lib/private_buffer.js deleted file mode 100644 index bd4202e..0000000 --- a/lib/private_buffer.js +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -// Define a property name which is unlikely to be used in end user code: -var PRIVATE_BUFFER = '__@@##$$@@__struct_buffer__@@$$##@@__'; - - -// EXPORTS // - -module.exports = PRIVATE_BUFFER; diff --git a/lib/resolve_alignment.js b/lib/resolve_alignment.js deleted file mode 100644 index d144812..0000000 --- a/lib/resolve_alignment.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Resolves the struct's byte alignment. -* -* @private -* @param {Array} fields - list of normalized field objects -* @returns {PositiveInteger} alignment -*/ -function alignment( fields ) { - var max; - var v; - var i; - - max = 0; - for ( i = 0; i < fields.length; i++ ) { - v = fields[ i ].alignment; - if ( v > max ) { - max = v; - } - } - return max; -} - - -// EXPORTS // - -module.exports = alignment; diff --git a/lib/set_bigint.js b/lib/set_bigint.js deleted file mode 100644 index 1fd462b..0000000 --- a/lib/set_bigint.js +++ /dev/null @@ -1,99 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive; -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive; -var isComplexLike = require( '@stdlib/assert-is-complex-like' ); -var isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' ); -var minDataType = require( '@stdlib/array-min-dtype' ); -var complexDType = require( '@stdlib/complex-dtype' ); -var BigInt = require( '@stdlib/bigint-ctor' ); -var Number = require( '@stdlib/number-ctor' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var format = require( '@stdlib/string-format' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); -var boolean2bigint = require( './boolean2bigint.js' ); -var defaults = require( './defaults.json' ); - - -// MAIN // - -/** -* Returns a function for writing field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for writing field data -*/ -function setBigInt( obj, method ) { - return setter; - - /** - * Writes a number value to an underlying byte buffer. - * - * @private - * @param {*} value - value to set - * @throws {TypeError} cannot cast provided values to field data type - */ - function setter( value ) { - var view; - var dt; - var v; - if ( isBigInt( value ) ) { - dt = 'int64'; // FIXME: support both int64 and uint64 - v = value; - } else if ( isNumber( value ) ) { - if ( isInteger( value ) ) { - dt = minDataType( value ); - v = BigInt( value ); - } else { - dt = defaults.dtypes.real; - v = BigInt( floor( value ) ); - } - } else if ( isBoolean( value ) ) { - dt = 'bool'; - v = boolean2bigint( value ); - } else if ( isComplexLike( value ) ) { - dt = complexDType( value ) || defaults.dtypes.complex; - v = BigInt( floor( value.re ) ); // discard imaginary component - } else { - dt = 'generic'; - v = BigInt( floor( Number( v ) ) ); - } - if ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) { - throw new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) ); - } - view = this[ PRIVATE_BUFFER ]; - view[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN ); - } -} - - -// EXPORTS // - -module.exports = setBigInt; diff --git a/lib/set_boolean.js b/lib/set_boolean.js deleted file mode 100644 index 00169a8..0000000 --- a/lib/set_boolean.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive; -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive; -var isComplexLike = require( '@stdlib/assert-is-complex-like' ); -var isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' ); -var complexDType = require( '@stdlib/complex-dtype' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); -var boolean2number = require( './boolean2number.js' ); -var number2boolean = require( './number2boolean.js' ); -var complex2boolean = require( './complex2boolean.js' ); -var bigint2boolean = require( './bigint2boolean.js' ); -var defaults = require( './defaults.json' ); - - -// MAIN // - -/** -* Returns a function for writing field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for writing field data -*/ -function setBoolean( obj, method ) { - return setter; - - /** - * Writes a boolean value to an underlying byte buffer. - * - * @private - * @param {*} value - value to set - * @throws {TypeError} cannot cast provided values to field data type - */ - function setter( value ) { - var view; - var dt; - var v; - if ( isBoolean( value ) ) { - dt = 'bool'; - v = boolean2number( value ); - } else if ( isNumber( value ) ) { - dt = defaults.dtypes.real; - v = boolean2number( number2boolean( value ) ); - } else if ( isBigInt( value ) ) { - dt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here - v = boolean2number( bigint2boolean( value ) ); - } else if ( isComplexLike( value ) ) { - dt = complexDType( value ) || defaults.dtypes.complex; - v = boolean2number( complex2boolean( value ) ); - } else { - dt = 'generic'; - v = Boolean( value ); - } - if ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) { - throw new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) ); - } - view = this[ PRIVATE_BUFFER ]; - view[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN ); - } -} - - -// EXPORTS // - -module.exports = setBoolean; diff --git a/lib/set_complex.js b/lib/set_complex.js deleted file mode 100644 index 7cd139a..0000000 --- a/lib/set_complex.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this, max-len */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive; -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive; -var isComplexLike = require( '@stdlib/assert-is-complex-like' ); -var isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' ); -var complexDType = require( '@stdlib/complex-dtype' ); -var format = require( '@stdlib/string-format' ); -var boolean2number = require( './boolean2number.js' ); -var bigint2number = require( './bigint2number.js' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for writing field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for writing field data -*/ -function setComplex( obj, method ) { - return setter; - - /** - * Writes a complex number to an underlying byte buffer. - * - * @private - * @param {*} value - value to set - * @throws {TypeError} cannot cast provided values to field data type - */ - function setter( value ) { - var view; - var dt; - var re; - var im; - if ( isComplexLike( value ) ) { - dt = complexDType( value ) || obj.type; - re = value.re; - im = value.im; - } else if ( isNumber( value ) ) { - dt = ( obj.type === 'complex64' ) ? 'float32' : 'float64'; - re = value; - im = 0.0; - } else if ( isBigInt( value ) ) { - dt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here - re = bigint2number( value ); - im = 0.0; - } else if ( isBoolean( value ) ) { - dt = 'bool'; - re = boolean2number( value ); - im = 0.0; - } else { - dt = 'generic'; - re = value; - im = 0.0; - } - if ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) { - throw new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) ); - } - view = this[ PRIVATE_BUFFER ]; - view[ method ]( obj.byteOffset, re, IS_LITTLE_ENDIAN ); - view[ method ]( obj.byteOffset+(obj.byteLength/2), im, IS_LITTLE_ENDIAN ); - } -} - - -// EXPORTS // - -module.exports = setComplex; diff --git a/lib/set_number.js b/lib/set_number.js deleted file mode 100644 index 99f8b27..0000000 --- a/lib/set_number.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var IS_LITTLE_ENDIAN = require( '@stdlib/assert-is-little-endian' ); -var isRealFloatingPointDataType = require( '@stdlib/array-base-assert-is-real-floating-point-data-type' ); // eslint-disable-line id-length -var isSignedIntegerDataType = require( '@stdlib/array-base-assert-is-signed-integer-data-type' ); -var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive; -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var isBigInt = require( '@stdlib/assert-is-bigint' ).isPrimitive; -var isComplexLike = require( '@stdlib/assert-is-complex-like' ); -var isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' ); -var minDataType = require( '@stdlib/array-min-dtype' ); -var minSignedIntegerDataType = require( '@stdlib/array-base-min-signed-integer-dtype' ); -var complexDType = require( '@stdlib/complex-dtype' ); -var format = require( '@stdlib/string-format' ); -var boolean2number = require( './boolean2number.js' ); -var bigint2number = require( './bigint2number.js' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); -var defaults = require( './defaults.json' ); - - -// MAIN // - -/** -* Returns a function for writing field data. -* -* @private -* @param {Object} obj - field object -* @param {string} method - data view method name -* @returns {Function} function for writing field data -*/ -function setNumber( obj, method ) { - return setter; - - /** - * Writes a number value to an underlying byte buffer. - * - * @private - * @param {*} value - value to set - * @throws {TypeError} cannot cast provided values to field data type - */ - function setter( value ) { - var view; - var dt; - var v; - if ( isNumber( value ) ) { - if ( isRealFloatingPointDataType( obj.type ) ) { - dt = obj.type; - } else if ( !isInteger( value ) ) { - dt = defaults.dtypes.real; - } else if ( isSignedIntegerDataType( obj.type ) ) { - dt = minSignedIntegerDataType( value ); - } else { - dt = minDataType( value ); - } - v = value; - } else if ( isComplexLike( value ) ) { - dt = complexDType( value ) || ( ( obj.type === 'float32' ) ? 'complex64' : 'complex128' ); - v = value.re; // discard imaginary component - } else if ( isBoolean( value ) ) { - dt = 'bool'; - v = boolean2number( value ); - } else if ( isBigInt( value ) ) { - dt = 'int64'; // note: the specific integer data type (int64 vs uint64) should not matter here - v = bigint2number( value ); - } else { - dt = 'generic'; - v = value; - } - if ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) { - throw new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) ); - } - view = this[ PRIVATE_BUFFER ]; - view[ method ]( obj.byteOffset, v, IS_LITTLE_ENDIAN ); - } -} - - -// EXPORTS // - -module.exports = setNumber; diff --git a/lib/set_struct.js b/lib/set_struct.js deleted file mode 100644 index 7e44c9a..0000000 --- a/lib/set_struct.js +++ /dev/null @@ -1,83 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var Uint8Array = require( '@stdlib/array-uint8' ); -var gcopy = require( '@stdlib/blas-base-gcopy' ); -var format = require( '@stdlib/string-format' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); -var isStructInstance = require( './is_struct_instance.js' ); - - -// MAIN // - -/** -* Returns a function for writing field data. -* -* @private -* @param {Object} obj - field object -* @returns {Function} function for writing field data -*/ -function setStruct( obj ) { - return setter; - - /** - * Writes `struct` data to an underlying byte buffer. - * - * @private - * @param {Object} value - value to set - * @throws {TypeError} must be a `struct` instance - * @throws {RangeError} must be a `struct` instance having the same byte length - * @throws {TypeError} cannot cast provided values to field data type - */ - function setter( value ) { - var view; - var dest; - var src; - var buf; - var nb; - if ( !isStructInstance( value ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a `struct` instance. Value: `%s`.', obj.name, value ) ); - } - if ( obj.casting === 'none' && !( value instanceof obj.type ) ) { - throw new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Value: `%s`.', obj.name, value ) ); - } - nb = obj.byteLength; - - buf = this.constructor.viewOf( value ); - if ( buf.byteLength !== nb ) { - throw new RangeError( format( 'invalid assignment. `%s` must be a `struct` instance having the same byte length.', obj.name ) ); - } - src = new Uint8Array( buf.buffer, buf.byteOffset, nb ); - - view = this[ PRIVATE_BUFFER ]; - dest = new Uint8Array( view.buffer, view.byteOffset+obj.byteOffset, nb ); // eslint-disable-line max-len - - gcopy( obj.length, src, 1, dest, 1 ); - } -} - - -// EXPORTS // - -module.exports = setStruct; diff --git a/lib/set_struct_array.js b/lib/set_struct_array.js deleted file mode 100644 index f7b5c0e..0000000 --- a/lib/set_struct_array.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var isCollection = require( '@stdlib/assert-is-collection' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var gcopy = require( '@stdlib/blas-base-gcopy' ); -var format = require( '@stdlib/string-format' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); - - -// MAIN // - -/** -* Returns a function for writing field data. -* -* @private -* @param {Object} obj - field object -* @returns {Function} function for writing field data -*/ -function setStructArray( obj ) { - return setter; - - /** - * Writes a list of `struct` instances to an underlying byte buffer. - * - * @private - * @param {Collection} values - list of `struct` instances - * @throws {TypeError} must provide an array-like object - * @throws {RangeError} must provide an array-like object having an expected length - * @throws {TypeError} cannot cast provided values to field data type - */ - function setter( values ) { - var offset; - var views; - var view; - var dest; - var src; - var buf; - var nb; - var i; - - if ( !isCollection( values ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', obj.name, values ) ); - } - if ( values.length !== obj.length ) { - throw new RangeError( format( 'invalid assignment. `%s` must be an array-like object having length %u.', obj.name, obj.length ) ); - } - if ( obj.casting === 'none' ) { - for ( i = 0; i < values.length; i++ ) { - if ( !( values[ i ] instanceof obj.type ) ) { // note: this check will fail for cross-realm `struct` instances - throw new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Value: `%s`.', obj.name, values[ i ] ) ); - } - } - } - // Compute the expected number of bytes per struct view: - nb = obj.byteLength / obj.length; // note: as a field is expected to have a homogeneous data type, the byte length should be evenly divisible by the number of elements - - // Check that all struct instances have the same byte length... - views = []; - for ( i = 0; i < values.length; i++ ) { - buf = this.constructor.viewOf( values[ i ] ); - if ( buf.byteLength !== nb ) { - throw new RangeError( format( 'invalid assignment. `%s` must be an array-like object containing `struct` instances having the same byte length.', obj.name ) ); - } - src = new Uint8Array( buf.buffer, buf.byteOffset, nb ); - views.push( src ); - } - // Write the data for each `struct` to the underlying byte buffer... - view = this[ PRIVATE_BUFFER ]; - offset = view.byteOffset + obj.byteOffset; - for ( i = 0; i < values.length; i++ ) { - dest = new Uint8Array( view.buffer, offset, nb ); - gcopy( obj.length, views[ i ], 1, dest, 1 ); - offset += nb; - } - } -} - - -// EXPORTS // - -module.exports = setStructArray; diff --git a/lib/set_typedarray.js b/lib/set_typedarray.js deleted file mode 100644 index 51e60ca..0000000 --- a/lib/set_typedarray.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-invalid-this, max-len */ - -'use strict'; - -// MODULES // - -var isCollection = require( '@stdlib/assert-is-collection' ); -var isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-cast' ); -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' ); -var isRealDataType = require( '@stdlib/array-base-assert-is-real-data-type' ); -var typedarray = require( '@stdlib/array-typed' ); -var dtype = require( '@stdlib/array-dtype' ); -var reinterpretComplex = require( '@stdlib/strided-base-reinterpret-complex' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var gcopy = require( '@stdlib/blas-base-gcopy' ); -var gfill = require( '@stdlib/blas-ext-base-gfill' ); -var map = require( '@stdlib/array-base-map' ); -var format = require( '@stdlib/string-format' ); -var PRIVATE_BUFFER = require( './private_buffer.js' ); -var isStructInstance = require( './is_struct_instance.js' ); -var number2boolean = require( './number2boolean.js' ); -var complex2boolean = require( './complex2boolean.js' ); -var complex2number = require( './complex2number.js' ); - - -// MAIN // - -/** -* Returns a function for writing field data. -* -* @private -* @param {Object} obj - field object -* @returns {Function} function for writing field data -*/ -function setTypedArray( obj ) { - return setter; - - /** - * Writes a list of values to a typed array view of an underlying byte buffer. - * - * @private - * @param {Collection} value - value to set - * @throws {TypeError} must provide an array-like object - * @throws {RangeError} must provide an array-like object having an expected length - * @throws {TypeError} cannot cast provided values to field data type - */ - function setter( value ) { - var view; - var buf; - var dt; - if ( !isCollection( value ) || isStructInstance( value ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array-like object. Value: `%s`.', obj.name, value ) ); - } - if ( value.length !== obj.length ) { - throw new RangeError( format( 'invalid assignment. `%s` must be an array-like object having length %u.', obj.name, obj.length ) ); - } - dt = dtype( value ); - if ( !isAllowedCast( dt, obj.type, obj.castingMode ) ) { - throw new TypeError( format( 'invalid assignment. Assigned value cannot be cast to the data type of `%s`. Data types: [%s, %s].', obj.name, obj.type, dt ) ); - } - buf = this[ PRIVATE_BUFFER ]; - view = typedarray( buf.buffer, buf.byteOffset+obj.byteOffset, obj.length, obj.type ); - if ( dt === obj.type ) { - // Case: complex => complex - if ( isComplexDataType( dt ) ) { - gcopy( obj.length*2, reinterpretComplex( value, 0 ), 1, reinterpretComplex( view, 0 ), 1 ); - return; - } - // Case: boolean => boolean - if ( isBooleanDataType( dt ) ) { - gcopy( obj.length, reinterpretBoolean( value, 0 ), 1, reinterpretBoolean( view, 0 ), 1 ); - return; - } - // Case: real => real - gcopy( obj.length, value, 1, view, 1 ); - return; - } - // Case: real => ??? - if ( isRealDataType( dt ) ) { - // Case: real => real - if ( isRealDataType( obj.type ) ) { - gcopy( obj.length, value, 1, view, 1 ); - return; - } - // Case: real => complex - if ( isComplexDataType( obj.type ) ) { - view = reinterpretComplex( view, 0 ); - - // TODO: consider refactoring to avoid two-passes; may require creating a separate strided utility explicitly aimed at casting real-valued arrays to complex arrays - gcopy( obj.length, view, 2, value, 1 ); // assign to only real-components - gfill.ndarray( obj.length, 0.0, view, 2, 1 ); // fill imaginary components with zeros - return; - } - // Case: real => boolean - map.assign( value, view, 1, 0, number2boolean ); - return; - } - // Case: complex => ??? - if ( isComplexDataType( dt ) ) { - // Case: complex => real - if ( isRealDataType( obj.type ) ) { - map.assign( value, view, 1, 0, complex2number ); // discard imaginary components - return; - } - // Case: complex => complex - if ( isComplexDataType( obj.type ) ) { - gcopy( obj.length*2, reinterpretComplex( value, 0 ), 1, reinterpretComplex( view, 0 ), 1 ); - return; - } - // Case: complex => boolean - map.assign( value, view, 1, 0, complex2boolean ); - return; - } - // Case: boolean => ??? - - // Case: boolean => real - if ( isRealDataType( obj.type ) ) { - gcopy( obj.length, reinterpretBoolean( value, 0 ), 1, view, 1 ); - return; - } - // Case: boolean => complex - view = reinterpretComplex( view, 0 ); - - // TODO: consider refactoring to avoid two-passes; may require creating a separate strided utility explicitly aimed at casting real-valued arrays to complex arrays - gcopy( obj.length, view, 2, reinterpretBoolean( value, 0 ), 1 ); // assign to only real-components - gfill.ndarray( obj.length, 0.0, view, 2, 1 ); // fill imaginary components with zeros - } -} - - -// EXPORTS // - -module.exports = setTypedArray; diff --git a/lib/setter.js b/lib/setter.js deleted file mode 100644 index c53252f..0000000 --- a/lib/setter.js +++ /dev/null @@ -1,87 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string-format' ); -var DATA_VIEW_METHODS = require( './data_view_methods.js' ); -var setNumber = require( './set_number.js' ); -var setComplex = require( './set_complex.js' ); -var setBoolean = require( './set_boolean.js' ); -var setBigInt = require( './set_bigint.js' ); -var setStruct = require( './set_struct.js' ); -var setTypedArray = require( './set_typedarray.js' ); -var setStructArray = require( './set_struct_array.js' ); - - -// MAIN // - -/** -* Returns a function for setting field data. -* -* @private -* @param {Object} obj - field object -* @throws {Error} unexpected error -* @returns {Function} function for setting field data -*/ -function setter( obj ) { - if ( obj.length ) { - if ( obj.isStructType ) { - return setStructArray( obj ); - } - return setTypedArray( obj ); - } - switch ( obj.type ) { - case 'float64': - case 'float32': - case 'float16': - case 'int8': - case 'int16': - case 'int32': - case 'uint8': - case 'uint16': - case 'uint32': - return setNumber( obj, DATA_VIEW_METHODS[ obj.type ].set ); - - case 'int64': - case 'uint64': - return setBigInt( obj, DATA_VIEW_METHODS[ obj.type ].set ); - - case 'bool': - return setBoolean( obj, DATA_VIEW_METHODS[ obj.type ].set ); - - case 'complex128': - case 'complex64': - case 'complex32': - return setComplex( obj, DATA_VIEW_METHODS[ obj.type ].set ); - - default: - if ( obj.isStructType ) { - return setStruct( obj ); - } - // Ensure that we fail loudly if we have failed to add support for newly added data types: - throw new Error( format( 'unexpected error. Unrecognized data type. Value: `%s`.', obj.type ) ); - } -} - - -// EXPORTS // - -module.exports = setter; diff --git a/lib/to_json.js b/lib/to_json.js deleted file mode 100644 index 1b06ccf..0000000 --- a/lib/to_json.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isCollection = require( '@stdlib/assert-is-collection' ); -var isComplexLike = require( '@stdlib/assert-is-complex-like' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var typedarray2json = require( '@stdlib/array-to-json' ); -var isStructInstance = require( './is_struct_instance.js' ); - - -// MAIN // - -/** -* Serializes a `struct` instance to JSON. -* -* @private -* @param {Struct} struct - struct instance -* @param {Array} fields - list of normalized fields -* @returns {Object} JSON representation -*/ -function toJSON( struct, fields ) { - var out; - var o; - var v; - var i; - - out = {}; - for ( i = 0; i < fields.length; i++ ) { - o = fields[ i ]; - v = struct[ o.name ]; - if ( isCollection( v ) ) { - v = typedarray2json( v ); - } else if ( isStructInstance( v ) ) { - v = v.toJSON(); - } else if ( isComplexLike( v ) && isFunction( v.toJSON ) ) { - v = v.toJSON(); - } - out[ o.name ] = v; - } - return out; -} - - -// EXPORTS // - -module.exports = toJSON; diff --git a/lib/to_string.js b/lib/to_string.js deleted file mode 100644 index c4e7fc6..0000000 --- a/lib/to_string.js +++ /dev/null @@ -1,83 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPlainObject = require( '@stdlib/assert-is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var contains = require( '@stdlib/array-base-assert-contains' ).factory; -var join = require( '@stdlib/array-base-join' ); -var format = require( '@stdlib/string-format' ); -var linearFormat = require( './format_linear.js' ); -var layoutFormat = require( './format_layout.js' ); - - -// VARIABLES // - -var FORMATS = [ - 'none', - 'linear', - 'layout' -]; -var isFormat = contains( FORMATS ); - - -// MAIN // - -/** -* Serializes a struct to a string. -* -* @private -* @param {Function} Struct - struct constructor -* @param {Array} fields - list of normalized fields -* @param {Options} options - function options -* @param {string} [options.format] - serialization format -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {string} string representation -*/ -function toString( Struct, fields, options ) { // eslint-disable-line stdlib/no-redeclare - var opts; - if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = { - 'format': 'none' - }; - if ( hasOwnProp( options, 'format' ) ) { - opts.format = options.format; - if ( !isFormat( opts.format ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'format', join( FORMATS, ', ' ), options.format ) ); - } - } - if ( opts.format === 'linear' ) { - return linearFormat( Struct, fields ); - } - if ( opts.format === 'layout' ) { - return layoutFormat( fields ); - } - // Case: opts.format === 'none' - return ''; -} - - -// EXPORTS // - -module.exports = toString; diff --git a/package.json b/package.json index 505fce5..0869429 100644 --- a/package.json +++ b/package.json @@ -3,30 +3,8 @@ "version": "0.1.1", "description": "Fixed-width composite data type (a.k.a., a `struct`).", "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", - "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", @@ -35,90 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-assert-contains": "^0.2.3", - "@stdlib/array-base-assert-is-boolean-data-type": "^0.0.2", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.2", - "@stdlib/array-base-assert-is-real-data-type": "^0.2.2", - "@stdlib/array-base-assert-is-real-floating-point-data-type": "^0.2.2", - "@stdlib/array-base-assert-is-signed-integer-data-type": "^0.2.2", - "@stdlib/array-base-filled": "^0.2.3", - "@stdlib/array-base-index-of": "^0.3.1", - "@stdlib/array-base-join": "^0.1.2", - "@stdlib/array-base-map": "^0.1.1", - "@stdlib/array-base-min-signed-integer-dtype": "^0.2.3", - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-dataview": "^0.2.3", - "@stdlib/array-dtype": "^0.3.1", - "@stdlib/array-min-dtype": "^0.3.1", - "@stdlib/array-to-json": "^0.3.1", - "@stdlib/array-typed": "^0.3.2", - "@stdlib/array-uint8": "^0.2.3", - "@stdlib/assert-has-own-property": "^0.2.3", - "@stdlib/assert-has-property": "^0.2.3", - "@stdlib/assert-is-arraybuffer": "^0.2.3", - "@stdlib/assert-is-bigint": "^0.2.4", - "@stdlib/assert-is-boolean": "^0.2.3", - "@stdlib/assert-is-collection": "^0.2.3", - "@stdlib/assert-is-complex-like": "^0.2.4", - "@stdlib/assert-is-dataview": "^0.2.3", - "@stdlib/assert-is-function": "^0.2.3", - "@stdlib/assert-is-integer": "^0.2.3", - "@stdlib/assert-is-little-endian": "^0.2.3", - "@stdlib/assert-is-nonnegative-integer": "^0.2.3", - "@stdlib/assert-is-number": "^0.2.3", - "@stdlib/assert-is-object": "^0.2.3", - "@stdlib/assert-is-plain-object": "^0.2.3", - "@stdlib/assert-is-positive-integer": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/assert-is-struct-constructor-like": "^0.1.1", - "@stdlib/bigint-ctor": "^0.2.3", - "@stdlib/blas-base-gcopy": "^0.2.3", - "@stdlib/blas-ext-base-gfill": "^0.2.3", - "@stdlib/boolean-ctor": "^0.2.3", - "@stdlib/complex-cmplx": "^0.2.3", - "@stdlib/complex-dtype": "^0.2.3", - "@stdlib/math-base-special-fast-min": "^0.3.1", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/ndarray-base-assert-is-allowed-data-type-cast": "^0.3.1", - "@stdlib/ndarray-base-bytes-per-element": "^0.3.1", - "@stdlib/number-ctor": "^0.2.3", - "@stdlib/strided-base-reinterpret-boolean": "^0.0.3", - "@stdlib/strided-base-reinterpret-complex": "^0.1.3", - "@stdlib/string-base-replace": "^0.2.3", - "@stdlib/string-format": "^0.2.3", - "@stdlib/utils-constant-function": "^0.2.3", - "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.2.4", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", - "@stdlib/utils-define-nonenumerable-read-write-accessor": "^0.2.3", - "@stdlib/utils-define-read-only-accessor": "^0.2.3", - "@stdlib/utils-define-read-write-accessor": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-float64": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/number-float64-base-to-words": "^0.2.3", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "data structures", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ec1319b --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 1c0e23c..0000000 --- a/test/test.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 struct = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof struct, 'function', 'main export is a function' ); - t.end(); -}); - -// FIXME: add tests