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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index a8d1b69..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/bool) 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 3e54158..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/bool) 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 fbca1a7..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: '37 1 * * 4' - - # 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 +``` -```javascript -var BooleanArray = require( '@stdlib/array-bool' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` @@ -1823,10 +1829,15 @@ var v = out.get( 0 ); -```javascript -var Uint8Array = require( '@stdlib/array-uint8' ); -var logEach = require( '@stdlib/console-log-each' ); -var BooleanArray = require( '@stdlib/array-bool' ); +```html + + + + + + + + + ```
@@ -1948,9 +1964,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. [mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/umd -[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer +[@stdlib/array/buffer]: https://github.com/stdlib-js/array-buffer/tree/umd
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.at.js b/benchmark/benchmark.at.js deleted file mode 100644 index d723421..0000000 --- a/benchmark/benchmark.at.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::nonnegative_indices:at', pkg ), function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.at( i%N ); - if ( typeof v !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( v ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::negative_indices:at', pkg ), function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.at( -(i%N)-1 ); - if ( typeof v !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( v ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.js b/benchmark/benchmark.copy_within.js deleted file mode 100644 index 58fa8a0..0000000 --- a/benchmark/benchmark.copy_within.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var format = require( '@stdlib/string-format' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-boolean' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:copyWithin', pkg ), function benchmark( b ) { - var arr; - var buf; - var i; - - arr = []; - for ( i = 0; i < 5; i++ ) { - arr.push( i%2 ); - } - arr = new BooleanArray( arr ); - buf = reinterpret( arr, 0 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = i%2; - arr = arr.copyWithin( 1, 0 ); - if ( typeof arr !== 'object' ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( buf[ 0 ] !== buf[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.copy_within.length.js b/benchmark/benchmark.copy_within.length.js deleted file mode 100644 index 8d3a2e7..0000000 --- a/benchmark/benchmark.copy_within.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-boolean' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var buf; - var i; - - arr = []; - for ( i = 0; i < len+1; i++ ) { - arr.push( i%2 ); - } - arr = new BooleanArray( arr ); - buf = reinterpret( arr, 0 ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = i%2; - arr = arr.copyWithin( 1, 0 ); - if ( typeof arr !== 'object' ) { - b.fail( 'unexpected result' ); - } - } - b.toc(); - if ( buf[ 0 ] !== buf[ 0 ] ) { - b.fail( 'should not be NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:copyWithin:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.entries.js b/benchmark/benchmark.entries.js deleted file mode 100644 index 6b55287..0000000 --- a/benchmark/benchmark.entries.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:entries', pkg ), function benchmark( b ) { - var iter; - var arr; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.entries(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof iter !== 'object' || typeof iter.next !== 'function' ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js deleted file mode 100644 index e650a2d..0000000 --- a/benchmark/benchmark.every.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:every', pkg ), function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.every( predicate ); - if ( typeof bool !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( bool ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v === true; - } -}); diff --git a/benchmark/benchmark.every.length.js b/benchmark/benchmark.every.length.js deleted file mode 100644 index 5365ce4..0000000 --- a/benchmark/benchmark.every.length.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math-base-special-pow' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Predicate function. -* -* @private -* @param {boolean} value - array element -* @param {NonNegativeInteger} idx - array element index -* @param {BooleanArray} arr - array instance -* @returns {boolean} boolean indicating whether a value passes a test -*/ -function predicate( value ) { - return value === true; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.every( predicate ); - if ( typeof bool !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( bool ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:every:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.fill.js b/benchmark/benchmark.fill.js deleted file mode 100644 index ae2bad3..0000000 --- a/benchmark/benchmark.fill.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:fill', pkg ), function benchmark( b ) { - var values; - var arr; - var out; - var i; - - values = [ - true, - false - ]; - arr = new BooleanArray( 5 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.fill( values[ i%values.length ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.fill.length.js b/benchmark/benchmark.fill.length.js deleted file mode 100644 index 18dad27..0000000 --- a/benchmark/benchmark.fill.length.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new BooleanArray( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - true, - false - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.fill( values[ i%values.length ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:fill:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.filter.js b/benchmark/benchmark.filter.js deleted file mode 100644 index 205402a..0000000 --- a/benchmark/benchmark.filter.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:filter', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return ( v === true ); - } -}); diff --git a/benchmark/benchmark.filter.length.js b/benchmark/benchmark.filter.length.js deleted file mode 100644 index af708a6..0000000 --- a/benchmark/benchmark.filter.length.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Predicate function. -* -* @private -* @param {boolean} value - array element -* @param {NonNegativeInteger} idx - array element index -* @param {BooleanArray} arr - array instance -* @returns {boolean} boolean indicating whether a value passes a test -*/ -function predicate( value ) { - return value === true; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.filter( predicate ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:filter:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.find.js b/benchmark/benchmark.find.js deleted file mode 100644 index 238da77..0000000 --- a/benchmark/benchmark.find.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:find', pkg ), function benchmark( b ) { - var arr; - var v; - var i; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.find( predicate ); - if ( typeof v !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( v ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return ( v === false ); - } -}); diff --git a/benchmark/benchmark.find.length.js b/benchmark/benchmark.find.length.js deleted file mode 100644 index 3a779bb..0000000 --- a/benchmark/benchmark.find.length.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Predicate function. -* -* @private -* @param {boolean} value - array element -* @param {NonNegativeInteger} idx - array element index -* @param {BooleanArray} arr - array instance -* @returns {boolean} boolean indicating whether a value passes a test -*/ -function predicate( value ) { - return ( value === false ); -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len-1; i++ ) { - arr.push( Boolean( 1 ) ); - } - arr.push( Boolean( 0 ) ); - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.find( predicate ); - if ( typeof v !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( v ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:find:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_index.js b/benchmark/benchmark.find_index.js deleted file mode 100644 index 4fb691c..0000000 --- a/benchmark/benchmark.find_index.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:findIndex', pkg ), function benchmark( b ) { - var arr; - var idx; - var i; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.findIndex( predicate ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return ( v === false ); - } -}); diff --git a/benchmark/benchmark.find_index.length.js b/benchmark/benchmark.find_index.length.js deleted file mode 100644 index d3cb0be..0000000 --- a/benchmark/benchmark.find_index.length.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Predicate function. -* -* @private -* @param {boolean} value - array element -* @param {NonNegativeInteger} idx - array element index -* @param {BooleanArray} arr - array instance -* @returns {boolean} boolean indicating whether a value passes a test -*/ -function predicate( value ) { - return ( value === true ); -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len-1; i++ ) { - arr.push( Boolean( 0 ) ); - } - arr.push( Boolean( 1 ) ); - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var idx; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.findIndex( predicate ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:findIndex:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_last.js b/benchmark/benchmark.find_last.js deleted file mode 100644 index db8d39f..0000000 --- a/benchmark/benchmark.find_last.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:findLast', pkg ), function benchmark( b ) { - var arr; - var v; - var i; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.findLast( predicate ); - if ( typeof v !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( v ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return ( v === false ); - } -}); diff --git a/benchmark/benchmark.find_last.length.js b/benchmark/benchmark.find_last.length.js deleted file mode 100644 index e08ce0f..0000000 --- a/benchmark/benchmark.find_last.length.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Predicate function. -* -* @private -* @param {boolean} value - array element -* @param {NonNegativeInteger} idx - array element index -* @param {BooleanArray} arr - array instance -* @returns {boolean} boolean indicating whether a value passes a test -*/ -function predicate( value ) { - return ( value === false ); -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - arr.push( Boolean( 0 ) ); - for ( i = 0; i < len-1; i++ ) { - arr.push( Boolean( 1 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.findLast( predicate ); - if ( typeof v !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( v ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:findLast:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.find_last_index.js b/benchmark/benchmark.find_last_index.js deleted file mode 100644 index 098ca6b..0000000 --- a/benchmark/benchmark.find_last_index.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:findLastIndex', pkg ), function benchmark( b ) { - var arr; - var idx; - var i; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.findLastIndex( predicate ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return ( v === false ); - } -}); diff --git a/benchmark/benchmark.find_last_index.length.js b/benchmark/benchmark.find_last_index.length.js deleted file mode 100644 index c4c4858..0000000 --- a/benchmark/benchmark.find_last_index.length.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Predicate function. -* -* @private -* @param {boolean} value - array element -* @param {NonNegativeInteger} idx - array element index -* @param {BooleanArray} arr - array instance -* @returns {boolean} boolean indicating whether a value passes a test -*/ -function predicate( value ) { - return ( value === true ); -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - arr.push( Boolean( 1 ) ); - for ( i = 0; i < len-1; i++ ) { - arr.push( Boolean( 0 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var idx; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.findLastIndex( predicate ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:findLastIndex:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.for_each.js b/benchmark/benchmark.for_each.js deleted file mode 100644 index 7332667..0000000 --- a/benchmark/benchmark.for_each.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:forEach', pkg ), function benchmark( b ) { - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( check ); - if ( arr.length !== 4 ) { - b.fail( 'should not change an array length' ); - } - } - b.toc(); - if ( arr.length !== 4 ) { - b.fail( 'should not change an array length' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function check( v ) { - if ( !isBoolean( v ) ) { - b.fail( 'should be a boolean' ); - } - } -}); diff --git a/benchmark/benchmark.for_each.length.js b/benchmark/benchmark.for_each.length.js deleted file mode 100644 index 673aaf2..0000000 --- a/benchmark/benchmark.for_each.length.js +++ /dev/null @@ -1,107 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr.forEach( callback ); - if ( arr.length !== len ) { - b.fail( 'should not change an array length' ); - } - } - b.toc(); - if ( arr.length !== len ) { - b.fail( 'should not change an array length' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function callback( value ) { - if ( value !== true ) { - throw new Error( 'something went wrong' ); - } - } - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:forEach:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.from.js b/benchmark/benchmark.from.js deleted file mode 100644 index bb8245f..0000000 --- a/benchmark/benchmark.from.js +++ /dev/null @@ -1,311 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( format( '%s::typed_array:from', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Uint8Array( 0 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( buf ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::typed_array:from:len=5', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Uint8Array( 5 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( buf ); - if ( arr.length !== 5 ) { - b.fail( 'should have length 5' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::typed_array,clbk:from:len=5', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Uint8Array( 5 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( buf, clbk ); - if ( arr.length !== 5 ) { - b.fail( 'should have length 5' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return !v; - } -}); - -bench( format( '%s::array:from', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = []; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( buf ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::array:from:len=5', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ true, true, true, true, true ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( buf ); - if ( arr.length !== 5 ) { - b.fail( 'should have length 5' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::array,clbk:from:len=5', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ true, true, true, true, true ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( buf, clbk ); - if ( arr.length !== 5 ) { - b.fail( 'should have length 5' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - return !v; - } -}); - -bench( format( '%s::iterable:from', pkg ), opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( createIterable() ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - return { - 'done': true - }; - } - } -}); - -bench( format( '%s::iterable:from:len=5', pkg ), opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( createIterable() ); - if ( arr.length !== 5 ) { - b.fail( 'should have length 5' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - return out; - - function iterator() { - var it = { - 'next': next, - 'i': 0, - 'N': 5 - }; - return it; - - function next() { - it.i += 1; - if ( it.i <= it.N ) { - return { - 'value': true - }; - } - return { - 'done': true - }; - } - } - } -}); - -bench( format( '%s::iterable,clbk:from:len=5', pkg ), opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.from( createIterable(), clbk ); - if ( arr.length !== 5 ) { - b.fail( 'should have length 5' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - return out; - - function iterator() { - var it = { - 'next': next, - 'i': 0, - 'N': 5 - }; - return it; - - function next() { - it.i += 1; - if ( it.i <= it.N ) { - return { - 'value': true - }; - } - return { - 'done': true - }; - } - } - } - - function clbk( v ) { - return !v; - } -}); diff --git a/benchmark/benchmark.get.js b/benchmark/benchmark.get.js deleted file mode 100644 index 60aeacb..0000000 --- a/benchmark/benchmark.get.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:get', pkg ), function benchmark( b ) { - var arr; - var N; - var v; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( i%2 ); - } - arr = new BooleanArray( arr ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.get( i%N ); - if ( typeof v !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( v ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.includes.js b/benchmark/benchmark.includes.js deleted file mode 100644 index c3041e7..0000000 --- a/benchmark/benchmark.includes.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:includes', pkg ), function benchmark( b ) { - var bool; - var arr; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.includes( true, 0 ); - if ( typeof bool !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( bool ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.includes.length.js b/benchmark/benchmark.includes.length.js deleted file mode 100644 index 3940f6d..0000000 --- a/benchmark/benchmark.includes.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len-1; i++ ) { - arr.push( false ); - } - arr.push( true ); - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.includes( true ); - if ( typeof bool !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( bool ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:includes:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.index_of.js b/benchmark/benchmark.index_of.js deleted file mode 100644 index a528420..0000000 --- a/benchmark/benchmark.index_of.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:indexOf', pkg ), function benchmark( b ) { - var arr; - var idx; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.indexOf( false, 0 ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.index_of.length.js b/benchmark/benchmark.index_of.length.js deleted file mode 100644 index 1db6584..0000000 --- a/benchmark/benchmark.index_of.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len-1; i++ ) { - arr.push( false ); - } - arr.push( true ); - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var idx; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.indexOf( true ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:indexOf:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.join.js b/benchmark/benchmark.join.js deleted file mode 100644 index 36c92cb..0000000 --- a/benchmark/benchmark.join.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:join', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.join(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.join.length.js b/benchmark/benchmark.join.length.js deleted file mode 100644 index 60a0c6b..0000000 --- a/benchmark/benchmark.join.length.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.join( '/' ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:join:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c530e1d..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,338 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 ArrayBuffer = require( '@stdlib/array-buffer' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( ITERATOR_SYMBOL === null ) -}; - - -// MAIN // - -bench( format( '%s::instantiation,new', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray(); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::instantiation,no_new', pkg ), function benchmark( b ) { - var ctor; - var arr; - var i; - - ctor = BooleanArray; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = ctor(); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::instantiation,length', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::instantiation,typed_array', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new Uint8Array( 0 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( buf ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::instantiation,array', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = []; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( buf ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::instantiation,iterable', pkg ), opts, function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( createIterable() ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createIterable() { - var out = {}; - out[ ITERATOR_SYMBOL ] = iterator; - return out; - - function iterator() { - return { - 'next': next - }; - } - - function next() { - return { - 'done': true - }; - } - } -}); - -bench( format( '%s::instantiation,arraybuffer', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new ArrayBuffer( 0 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( buf ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::instantiation,arraybuffer,byte_offset', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new ArrayBuffer( 8 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( buf, 8 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::instantiation,arraybuffer,byte_offset,length', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = new ArrayBuffer( 8 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( buf, 8, 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::get:buffer', pkg ), function benchmark( b ) { - var arr; - var v; - var i; - - arr = new BooleanArray(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.buffer; - if ( typeof v !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArrayBuffer( v ) ) { - b.fail( 'should return an ArrayBuffer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::get:byteLength', pkg ), function benchmark( b ) { - var arr; - var v; - var i; - - arr = new BooleanArray(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteLength; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::get:byteOffset', pkg ), function benchmark( b ) { - var arr; - var v; - var i; - - arr = new BooleanArray(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.byteOffset; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::get:length', pkg ), function benchmark( b ) { - var arr; - var v; - var i; - - arr = new BooleanArray(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - // Note: the following may be optimized away due to loop invariant code motion and/or other compiler optimizations, rendering this benchmark meaningless... - v = arr.length; - if ( v !== v ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( v ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.js b/benchmark/benchmark.keys.js deleted file mode 100644 index dd7838d..0000000 --- a/benchmark/benchmark.keys.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isIteratorLike = require( '@stdlib/assert-is-iterator-like' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:keys', pkg ), function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new BooleanArray( [ true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isIteratorLike( iter ) ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.keys.length.js b/benchmark/benchmark.keys.length.js deleted file mode 100644 index 06dd29e..0000000 --- a/benchmark/benchmark.keys.length.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isIteratorLike = require( '@stdlib/assert-is-iterator-like' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var iter; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.keys(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isIteratorLike( iter ) ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:keys:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.last_index_of.js b/benchmark/benchmark.last_index_of.js deleted file mode 100644 index 472140b..0000000 --- a/benchmark/benchmark.last_index_of.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:lastIndexOf', pkg ), function benchmark( b ) { - var arr; - var idx; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( false ); - } - arr = new BooleanArray( arr ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.lastIndexOf( true, 0 ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.last_index_of.length.js b/benchmark/benchmark.last_index_of.length.js deleted file mode 100644 index c081a75..0000000 --- a/benchmark/benchmark.last_index_of.length.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = [ true ]; - for ( i = 1; i < len; i++ ) { - arr.push( false ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var idx; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - idx = arr.lastIndexOf( true ); - if ( typeof idx !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( idx ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:lastIndexOf:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2290108..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = new BooleanArray( len ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.map.js b/benchmark/benchmark.map.js deleted file mode 100644 index 1d18f3a..0000000 --- a/benchmark/benchmark.map.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:map', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( invert ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function invert( v ) { - return !v; - } -}); diff --git a/benchmark/benchmark.map.length.js b/benchmark/benchmark.map.length.js deleted file mode 100644 index 8c194e1..0000000 --- a/benchmark/benchmark.map.length.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var identity = require( '@stdlib/utils-identity-function' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.map( identity ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:map:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.of.js b/benchmark/benchmark.of.js deleted file mode 100644 index 7514266..0000000 --- a/benchmark/benchmark.of.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:of', pkg ), function benchmark( b ) { - var arr; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.of(); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:of:len=5', pkg ), function benchmark( b ) { - var buf; - var arr; - var i; - - buf = [ true, true, true, true, true ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = BooleanArray.of.apply( BooleanArray, buf ); - if ( arr.length !== 5 ) { - b.fail( 'should have length 5' ); - } - } - b.toc(); - if ( !(arr instanceof BooleanArray) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.js b/benchmark/benchmark.reduce.js deleted file mode 100644 index 4d6ab4e..0000000 --- a/benchmark/benchmark.reduce.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Reducer function. -* -* @private -* @param {integer} acc - accumulated value -* @param {boolean} value - current array element -* @param {integer} index - current array index -* @returns {integer} accumulated value -*/ -function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; -} - - -// MAIN // - -bench( format( '%s:reduce', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( reducer, 0 ); - if ( typeof out !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce.length.js b/benchmark/benchmark.reduce.length.js deleted file mode 100644 index e8d2c0e..0000000 --- a/benchmark/benchmark.reduce.length.js +++ /dev/null @@ -1,120 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Reducer function. -* -* @private -* @param {integer} acc - accumulated value -* @param {boolean} value - current array element -* @param {integer} index - current array index -* @returns {integer} accumulated value -*/ -function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduce( reducer, 0 ); - if ( typeof out !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:reduce:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.reduce_right.js b/benchmark/benchmark.reduce_right.js deleted file mode 100644 index 1cff5f0..0000000 --- a/benchmark/benchmark.reduce_right.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Reducer function. -* -* @private -* @param {integer} acc - accumulated value -* @param {boolean} value - current array element -* @param {integer} index - current array index -* @returns {integer} accumulated value -*/ -function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; -} - - -// MAIN // - -bench( format( '%s:reduceRight', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( reducer, 0 ); - if ( typeof out !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reduce_right.length.js b/benchmark/benchmark.reduce_right.length.js deleted file mode 100644 index ac6a7bb..0000000 --- a/benchmark/benchmark.reduce_right.length.js +++ /dev/null @@ -1,120 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Reducer function. -* -* @private -* @param {integer} acc - accumulated value -* @param {boolean} value - current array element -* @param {integer} index - current array index -* @returns {integer} accumulated value -*/ -function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reduceRight( reducer, 0 ); - if ( typeof out !== 'number' ) { - b.fail( 'should return an integer' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:reduceRight:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.reverse.js b/benchmark/benchmark.reverse.js deleted file mode 100644 index 2e76d3a..0000000 --- a/benchmark/benchmark.reverse.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:reverse', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.reverse.length.js b/benchmark/benchmark.reverse.length.js deleted file mode 100644 index 7d9d2a4..0000000 --- a/benchmark/benchmark.reverse.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.reverse(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:reverse:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.set.js b/benchmark/benchmark.set.js deleted file mode 100644 index 43f2780..0000000 --- a/benchmark/benchmark.set.js +++ /dev/null @@ -1,120 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::boolean:set', pkg ), function benchmark( b ) { - var values; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i%2 ); - } - arr = new BooleanArray( values ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( values[ (i+1)%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::array:set', pkg ), function benchmark( b ) { - var values; - var arr; - var N; - var v; - var i; - - values = []; - for ( i = 0; i < 10; i++ ) { - values.push( i%2 ); - } - arr = new BooleanArray( values ); - N = arr.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr.set( [ values[ (i+1)%N ] ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::typed_array:set', pkg ), function benchmark( b ) { - var values; - var arr; - var buf; - var N; - var v; - var i; - - values = new Uint8Array( 20 ); - N = values.length; - for ( i = 0; i < N; i++ ) { - values[ i ] = i % 2; - } - arr = new BooleanArray( values ); - buf = new Uint8Array( 1 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - buf[ 0 ] = values[ i%N ]; - v = arr.set( buf ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.set.length.js b/benchmark/benchmark.set.length.js deleted file mode 100644 index 0650925..0000000 --- a/benchmark/benchmark.set.length.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var randu = require( '@stdlib/random-base-randu' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var values; - var arr1; - var arr2; - var arr3; - var N; - var i; - - arr1 = []; - arr2 = []; - arr3 = []; - for ( i = 0; i < len; i++ ) { - arr1.push( i > (len/2) ); - arr2.push( randu() > 0.5 ); - arr3.push( randu() < 0.2 ); - } - arr1 = new BooleanArray( arr1 ); - - values = [ - new BooleanArray( arr2 ), - new BooleanArray( arr3 ) - ]; - N = values.length; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = arr1.set( values[ i%N ] ); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - } - b.toc(); - if ( typeof v !== 'undefined' ) { - b.fail( 'should return undefined' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:set:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.slice.js b/benchmark/benchmark.slice.js deleted file mode 100644 index dd5928e..0000000 --- a/benchmark/benchmark.slice.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:slice', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.slice.length.js b/benchmark/benchmark.slice.length.js deleted file mode 100644 index b016a0f..0000000 --- a/benchmark/benchmark.slice.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.slice(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:slice:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.some.js b/benchmark/benchmark.some.js deleted file mode 100644 index a237576..0000000 --- a/benchmark/benchmark.some.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:every', pkg ), function benchmark( b ) { - var bool; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( predicate ); - if ( typeof bool !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( bool ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function predicate( v ) { - return v === true; - } -}); diff --git a/benchmark/benchmark.some.length.js b/benchmark/benchmark.some.length.js deleted file mode 100644 index 04670b9..0000000 --- a/benchmark/benchmark.some.length.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Predicate function. -* -* @private -* @param {boolean} value - array element -* @param {NonNegativeInteger} idx - array element index -* @param {BooleanArray} arr - array instance -* @returns {boolean} boolean indicating whether a value passes a test -*/ -function predicate( value ) { - return value === true; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 1; i < len; i++ ) { - arr.push( Boolean( 0 ) ); - } - arr.push( Boolean( 1 ) ); - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var bool; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = arr.some( predicate ); - if ( typeof bool !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( bool ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:some:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.sort.js b/benchmark/benchmark.sort.js deleted file mode 100644 index 58771a9..0000000 --- a/benchmark/benchmark.sort.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Comparison function. -* -* @private -* @param {boolean} a - first boolean value for comparison -* @param {boolean} b - second boolean value for comparison -* @returns {number} comparison result -*/ -function compareFcn( a, b ) { - if ( a === true ) { - if ( b === true ) { - return 0; - } - return 1; - } - if ( b === false ) { - return 0; - } - return -1; -} - - -// MAIN // - -bench( format( '%s:sort', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.sort( compareFcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.sort.length.js b/benchmark/benchmark.sort.length.js deleted file mode 100644 index 450d393..0000000 --- a/benchmark/benchmark.sort.length.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Comparison function. -* -* @private -* @param {boolean} a - first boolean value for comparison -* @param {boolean} b - second boolean value for comparison -* @returns {number} comparison result -*/ -function compareFcn( a, b ) { - if ( a === true ) { - if ( b === true ) { - return 0; - } - return 1; - } - if ( b === false ) { - return 0; - } - return -1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.sort( compareFcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:sort:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.subarray.js b/benchmark/benchmark.subarray.js deleted file mode 100644 index 3139e8e..0000000 --- a/benchmark/benchmark.subarray.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:subarray', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.subarray.length.js b/benchmark/benchmark.subarray.length.js deleted file mode 100644 index 08bd8cc..0000000 --- a/benchmark/benchmark.subarray.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.subarray(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:subarray:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_locale_string.js b/benchmark/benchmark.to_locale_string.js deleted file mode 100644 index a6aa620..0000000 --- a/benchmark/benchmark.to_locale_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:toLocaleString', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_locale_string.length.js b/benchmark/benchmark.to_locale_string.length.js deleted file mode 100644 index c7237e0..0000000 --- a/benchmark/benchmark.to_locale_string.length.js +++ /dev/null @@ -1,102 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toLocaleString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:toLocaleString:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_reversed.js b/benchmark/benchmark.to_reversed.js deleted file mode 100644 index c987692..0000000 --- a/benchmark/benchmark.to_reversed.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:toReversed', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toReversed(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_reversed.length.js b/benchmark/benchmark.to_reversed.length.js deleted file mode 100644 index efe6f7e..0000000 --- a/benchmark/benchmark.to_reversed.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toReversed(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:toReversed:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_sorted.js b/benchmark/benchmark.to_sorted.js deleted file mode 100644 index 5d2ee7e..0000000 --- a/benchmark/benchmark.to_sorted.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Comparison function. -* -* @private -* @param {boolean} a - first boolean value for comparison -* @param {boolean} b - second boolean value for comparison -* @returns {number} comparison result -*/ -function compareFcn( a, b ) { - if ( a === true ) { - if ( b === true ) { - return 0; - } - return 1; - } - if ( b === false ) { - return 0; - } - return -1; -} - - -// MAIN // - -bench( format( '%s:toSorted', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toSorted( compareFcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_sorted.length.js b/benchmark/benchmark.to_sorted.length.js deleted file mode 100644 index e6b22dd..0000000 --- a/benchmark/benchmark.to_sorted.length.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Comparison function. -* -* @private -* @param {boolean} a - first boolean value for comparison -* @param {boolean} b - second boolean value for comparison -* @returns {number} comparison result -*/ -function compareFcn( a, b ) { - if ( a === true ) { - if ( b === true ) { - return 0; - } - return 1; - } - if ( b === false ) { - return 0; - } - return -1; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toSorted( compareFcn ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:toSorted:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.to_string.js b/benchmark/benchmark.to_string.js deleted file mode 100644 index 5d07525..0000000 --- a/benchmark/benchmark.to_string.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:toString', pkg ), function benchmark( b ) { - var out; - var arr; - var i; - - arr = new BooleanArray( [ true, false, false, true ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.to_string.length.js b/benchmark/benchmark.to_string.length.js deleted file mode 100644 index 2580a16..0000000 --- a/benchmark/benchmark.to_string.length.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( Boolean( i%2 ) ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.toString(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:toString:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.values.js b/benchmark/benchmark.values.js deleted file mode 100644 index 2a4ed7f..0000000 --- a/benchmark/benchmark.values.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isIteratorLike = require( '@stdlib/assert-is-iterator-like' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:values', pkg ), function benchmark( b ) { - var iter; - var arr; - var i; - - arr = new BooleanArray( [ true, false ] ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isIteratorLike( iter ) ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.values.length.js b/benchmark/benchmark.values.length.js deleted file mode 100644 index aa194b4..0000000 --- a/benchmark/benchmark.values.length.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isIteratorLike = require( '@stdlib/assert-is-iterator-like' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr; - var i; - - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( true ); - } - arr = new BooleanArray( arr ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var iter; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = arr.values(); - if ( typeof iter !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isIteratorLike( iter ) ) { - b.fail( 'should return an iterator protocol-compliant object' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:values:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.with.js b/benchmark/benchmark.with.js deleted file mode 100644 index 9b8ade2..0000000 --- a/benchmark/benchmark.with.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// MAIN // - -bench( format( '%s:with', pkg ), function benchmark( b ) { - var values; - var arr; - var out; - var i; - - values = [ - true, - false - ]; - arr = new BooleanArray( 5 ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.with( i%arr.length, values[ i%values.length ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.with.length.js b/benchmark/benchmark.with.length.js deleted file mode 100644 index 22bd801..0000000 --- a/benchmark/benchmark.with.length.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isBooleanArray = require( '@stdlib/assert-is-booleanarray' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var arr = new BooleanArray( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - true, - false - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = arr.with( i%len, values[ i%values.length ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isBooleanArray( out ) ) { - b.fail( 'should return a BooleanArray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:with:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 0595000..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/bool" -%% click B href "https://github.com/stdlib-js/array-bool/tree/main" -%% click C href "https://github.com/stdlib-js/array-bool/tree/production" -%% click D href "https://github.com/stdlib-js/array-bool/tree/esm" -%% click E href "https://github.com/stdlib-js/array-bool/tree/deno" -%% click F href "https://github.com/stdlib-js/array-bool/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/bool -[production-url]: https://github.com/stdlib-js/array-bool/tree/production -[deno-url]: https://github.com/stdlib-js/array-bool/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-bool/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-bool/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-bool/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-bool/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-bool/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..374d727 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var r,t;r=this,t=function(){"use strict";var r="function"==typeof Object.defineProperty?Object.defineProperty:null,t=Object.defineProperty;function e(r){return"number"==typeof r}function n(r){var t,e="";for(t=0;t0&&(e-=1),n=r.toExponential(e)):n=r.toPrecision(t.precision),t.alternate||(n=h.call(n,b,"$1e"),n=h.call(n,v,"e"),n=h.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,p,"e-0$1"),t.alternate&&(n=h.call(n,y,"$1."),n=h.call(n,w,"$1.e")),r>=0&&t.sign&&(n=t.sign+n),n=t.specifier===s.call(t.specifier)?s.call(n):l.call(n)}function E(r){var t,e="";for(t=0;t127)throw new Error("invalid character code. Value: "+o.arg);o.arg=m(u)?String(o.arg):_(u)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(t||(o.precision=6),h=parseFloat(o.arg),!isFinite(h)){if(!e(o.arg))throw new Error("invalid floating-point number. Value: "+l);h=o.arg,o.padZeros=!1}o.arg=d(h,o);break;default:throw new Error("invalid specifier: "+o.specifier)}o.maxWidth>=0&&o.arg.length>o.maxWidth&&(o.arg=o.arg.substring(0,o.maxWidth)),o.padZeros?o.arg=i(o.arg,o.width||o.precision,o.padRight):o.width&&(o.arg=(y=o.arg,w=o.width,g=o.padRight,v=void 0,(v=w-y.length)<0?y:y=g?y+E(v):E(v)+y)),l+=o.arg||"",s+=1}return l}var x=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function A(r){var t={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(t.precision="1"),t}function O(r){var t,e,n,i;for(e=[],i=0,n=x.exec(r);n;)(t=r.slice(i,x.lastIndex-n[0].length)).length&&e.push(t),"%"===n[6]?e.push("%"):e.push(A(n)),i=x.lastIndex,n=x.exec(r);return(t=r.slice(i)).length&&e.push(t),e}function I(r){var t,e;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(t=[O(r)],e=1;err&&er(r)}function ir(r){return U(r)&&nr(r)}function or(r){return q(r)&&nr(r.valueOf())}function ar(r){return ir(r)||or(r)}function fr(r){return ir(r)&&r>=0}function ur(r){return or(r)&&r.valueOf()>=0}function lr(r){return fr(r)||ur(r)}C(ar,"isPrimitive",ir),C(ar,"isObject",or),C(lr,"isPrimitive",fr),C(lr,"isObject",ur);var sr=9007199254740991;function hr(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&er(r.length)&&r.length>=0&&r.length<=sr}var cr="function"==typeof ArrayBuffer;function pr(r){return cr&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===z(r)}var yr=Array.isArray?Array.isArray:function(r){return"[object Array]"===z(r)};function wr(r){return"object"==typeof r&&null!==r&&!yr(r)}var gr=/./;function vr(r){return"boolean"==typeof r}var br=Boolean,dr=Boolean.prototype.toString,Er=$();function _r(r){return"object"==typeof r&&(r instanceof br||(Er?function(r){try{return dr.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===z(r)))}function Tr(r){return vr(r)||_r(r)}C(Tr,"isPrimitive",vr),C(Tr,"isObject",_r);var mr="object"==typeof self?self:null,jr="object"==typeof window?window:null,Sr="object"==typeof globalThis?globalThis:null,xr=function(r){if(arguments.length){if(!vr(r))throw new TypeError(I("invalid argument. Must provide a boolean. Value: `%s`.",r));if(r)return new Function("return this;")()}if(Sr)return Sr;if(mr)return mr;if(jr)return jr;throw new Error("unexpected error. Unable to resolve global object.")}(),Ar=xr.document&&xr.document.childNodes,Or=Int8Array;function Ir(){return/^\s*function\s*([^(]*)/i}var kr=/^\s*function\s*([^(]*)/i;function Lr(r){if("function"!=typeof r)throw new TypeError(I("invalid argument. Must provide a function. Value: `%s`.",r));return function(t){var e,n;if(!yr(t))return!1;if(0===(e=t.length))return!1;for(n=0;ne.byteLength-r)throw new RangeError(Qr("null2G",n*tt));e=new Kr(e,r,n)}}return C(this,"_buffer",e),C(this,"_length",e.length),this}return C(ot,"BYTES_PER_ELEMENT",tt),C(ot,"name","BooleanArray"),C(ot,"from",(function(r){var t,e,n,i,o,a,f,u,l;if(!Br(this))throw new TypeError(Qr("null01"));if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if((e=arguments.length)>1){if(!Br(n=arguments[1]))throw new TypeError(Qr("null2H",n));e>2&&(t=arguments[2])}if(hr(r)){if(n){for(u=r.length,f=r.get&&r.set?function(r){var t=Dr[r];return"function"==typeof t?t:Dr.default}("default"):function(r){var t=qr[r];return"function"==typeof t?t:qr.default}("default"),o=(i=new this(u))._buffer,l=0;l=e))return br(t[r])})),Xr(ot.prototype,"buffer",(function(){return this._buffer.buffer})),Xr(ot.prototype,"byteLength",(function(){return this._buffer.byteLength})),Xr(ot.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(ot.prototype,"BYTES_PER_ELEMENT",ot.BYTES_PER_ELEMENT),C(ot.prototype,"copyWithin",(function(r,t){if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return 2===arguments.length?this._buffer.copyWithin(r,t):this._buffer.copyWithin(r,t,arguments[2]),this})),C(ot.prototype,"entries",(function(){var r,t,e,n,i,o;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return r=this,n=this._buffer,e=this._length,o=-1,C(t={},"next",(function(){return o+=1,i||o>=e?{done:!0}:{value:[o,br(n[o])],done:!1}})),C(t,"return",(function(r){return i=!0,arguments.length?{value:r,done:!0}:{done:!0}})),Zr&&C(t,Zr,(function(){return r.entries()})),t})),C(ot.prototype,"every",(function(r,t){var e,n;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Br(r))throw new TypeError(Qr("null3c",r));for(e=this._buffer,n=0;n1){if(!ir(t))throw new TypeError(Qr("null7f",t));if(t<0&&(t+=i)<0&&(t=0),arguments.length>2){if(!ir(e))throw new TypeError(Qr("null2z",e));e<0&&(e+=i)<0&&(e=0),e>i&&(e=i)}else e=i}else t=0,e=i;for(o=r?1:0,a=t;a=0;i--)if(n=br(e[i]),r.call(t,n,i,this))return n})),C(ot.prototype,"findLastIndex",(function(r,t){var e,n,i;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Br(r))throw new TypeError(Qr("null3c",r));for(e=this._buffer,i=this._length-1;i>=0;i--)if(n=br(e[i]),r.call(t,n,i,this))return i;return-1})),C(ot.prototype,"forEach",(function(r,t){var e,n;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Br(r))throw new TypeError(Qr("null3c",r));for(e=this._buffer,n=0;n=this._length))return br(this._buffer[r])})),C(ot.prototype,"includes",(function(r,t){var e,n;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vr(r))throw new TypeError(Qr("invalid argument. First argument must be a boolean. Value: `%s`.",r));if(arguments.length>1){if(!ir(t))throw new TypeError(Qr("null7f",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(e=this._buffer,n=t;n1){if(!ir(t))throw new TypeError(Qr("null7f",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(e=this._buffer,n=t;n0){if(!Rr(r))throw new TypeError(Qr("null3F",r))}else r=",";for(t=this._buffer,e=[],n=0;n=e?{done:!0}:{value:i,done:!1}})),C(t,"return",(function(r){return n=!0,arguments.length?{value:r,done:!0}:{done:!0}})),Zr&&C(t,Zr,(function(){return r.keys()})),t})),C(ot.prototype,"lastIndexOf",(function(r,t){var e,n;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vr(r))throw new TypeError(Qr("invalid argument. First argument must be a boolean. Value: `%s`.",r));if(arguments.length>1){if(!ir(t))throw new TypeError(Qr("null7f",t));t>=this._length?t=this._length-1:t<0&&(t+=this._length)}else t=this._length-1;for(e=this._buffer,n=t;n>=0;n--)if(r===br(e[n]))return n;return-1})),Xr(ot.prototype,"length",(function(){return this._length})),C(ot.prototype,"map",(function(r,t){var e,n,i,o;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Br(r))throw new TypeError(Qr("null3c"),r);for(i=this._buffer,e=(n=new this.constructor(this._length))._buffer,o=0;o1)i=t,o=0;else{if(0===n)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");i=br(e[0]),o=1}for(;o1)i=t,o=n-1;else{if(0===n)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");i=br(e[n-1]),o=n-2}for(;o>=0;o--)i=r(i,br(e[o]),o,this);return i})),C(ot.prototype,"reverse",(function(){var r,t,e,n,i,o;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(r=this._buffer,e=this._length,n=tr(e/2),i=0;i1){if(!fr(e=arguments[1]))throw new TypeError(Qr("null2L",e))}else e=0;if(hr(r)){if(e+(o=r.length)>this._length)throw new RangeError(Qr("null03"));if(t=nt(r)?r._buffer:r,f=n.byteOffset+e*tt,t.buffer===n.buffer&&t.byteOffsetf){for(i=new Kr(t.length),a=0;a=this._length)throw new RangeError(Qr("null2M",e));n[e]=r?1:0}})),C(ot.prototype,"slice",(function(r,t){var e,n,i,o,a,f;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(o=this._buffer,a=this._length,0===arguments.length)r=0,t=a;else{if(!ir(r))throw new TypeError(Qr("null7e",r));if(r<0&&(r+=a)<0&&(r=0),1===arguments.length)t=a;else{if(!ir(t))throw new TypeError(Qr("null7f",t));t<0?(t+=a)<0&&(t=0):t>a&&(t=a)}}for(e=ri&&(t=i)}}return r>=i?(i=0,e=n.byteLength):r>=t?(i=0,e=n.byteOffset+r*tt):(i=t-r,e=n.byteOffset+r*tt),new this.constructor(n.buffer,e,i<0?0:i)})),C(ot.prototype,"toLocaleString",(function(r,t){var e,n,i,o,a;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(0===arguments.length)n=[];else{if(!Rr(r)&&!$r(r))throw new TypeError(Qr("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",r));n=r}if(arguments.length<2)e={};else{if(!wr(t))throw new TypeError(Qr("null2V",t));e=t}for(o=this._buffer,i=[],a=0;a=e?{done:!0}:{value:br(i[o]),done:!1}})),C(r,"return",(function(r){return n=!0,arguments.length?{value:r,done:!0}:{done:!0}})),Zr&&C(r,Zr,(function(){return t.values()})),r})),C(ot.prototype,"with",(function(r,t){var e,n;if(!nt(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!ir(r))throw new TypeError(Qr("null7e",r));if(n=this._length,r<0&&(r+=n),r<0||r>=n)throw new RangeError(Qr("nullFP",r));if(!vr(t))throw new TypeError(Qr("null55",t));return(e=new this.constructor(this._buffer))._buffer[r]=t?1:0,e})),ot},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(r="undefined"!=typeof globalThis?globalThis:r||self).BooleanArray=t(); +//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map new file mode 100644 index 0000000..858b47d --- /dev/null +++ b/browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.js","sources":["../node_modules/@stdlib/utils-define-property/lib/define_property.js","../node_modules/@stdlib/utils-define-property/lib/builtin.js","../node_modules/@stdlib/string-base-format-interpolate/lib/is_number.js","../node_modules/@stdlib/string-base-format-interpolate/lib/zero_pad.js","../node_modules/@stdlib/string-base-format-interpolate/lib/format_integer.js","../node_modules/@stdlib/string-base-format-interpolate/lib/format_double.js","../node_modules/@stdlib/string-base-format-interpolate/lib/space_pad.js","../node_modules/@stdlib/string-base-format-interpolate/lib/main.js","../node_modules/@stdlib/string-base-format-interpolate/lib/is_string.js","../node_modules/@stdlib/string-base-format-tokenize/lib/main.js","../node_modules/@stdlib/string-format/lib/main.js","../node_modules/@stdlib/string-format/lib/is_string.js","../node_modules/@stdlib/utils-define-property/lib/polyfill.js","../node_modules/@stdlib/utils-define-property/lib/index.js","../node_modules/@stdlib/utils-define-property/lib/has_define_property_support.js","../node_modules/@stdlib/utils-define-nonenumerable-read-only-property/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/primitive.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/number-ctor/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/tostring.js","../node_modules/@stdlib/assert-is-number/lib/object.js","../node_modules/@stdlib/assert-is-number/lib/try2serialize.js","../node_modules/@stdlib/assert-is-number/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/index.js","../node_modules/@stdlib/constants-float64-pinf/lib/index.js","../node_modules/@stdlib/constants-float64-ninf/lib/index.js","../node_modules/@stdlib/math-base-special-floor/lib/main.js","../node_modules/@stdlib/math-base-assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/integer.js","../node_modules/@stdlib/assert-is-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-integer/lib/object.js","../node_modules/@stdlib/assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/object.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/index.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/index.js","../node_modules/@stdlib/constants-array-max-typed-array-length/lib/index.js","../node_modules/@stdlib/assert-is-collection/lib/main.js","../node_modules/@stdlib/assert-is-arraybuffer/lib/main.js","../node_modules/@stdlib/assert-is-array/lib/main.js","../node_modules/@stdlib/assert-is-object/lib/main.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/re.js","../node_modules/@stdlib/assert-is-boolean/lib/primitive.js","../node_modules/@stdlib/boolean-ctor/lib/main.js","../node_modules/@stdlib/assert-is-boolean/lib/tostring.js","../node_modules/@stdlib/assert-is-boolean/lib/object.js","../node_modules/@stdlib/assert-is-boolean/lib/try2serialize.js","../node_modules/@stdlib/assert-is-boolean/lib/main.js","../node_modules/@stdlib/assert-is-boolean/lib/index.js","../node_modules/@stdlib/utils-global/lib/self.js","../node_modules/@stdlib/utils-global/lib/window.js","../node_modules/@stdlib/utils-global/lib/global_this.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/nodelist.js","../node_modules/@stdlib/utils-global/lib/browser.js","../node_modules/@stdlib/utils-global/lib/codegen.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/typedarray.js","../node_modules/@stdlib/regexp-function-name/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/regexp.js","../node_modules/@stdlib/assert-tools-array-function/lib/main.js","../node_modules/@stdlib/assert-is-object-like/lib/main.js","../node_modules/@stdlib/utils-constructor-name/lib/main.js","../node_modules/@stdlib/assert-is-buffer/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/index.js","../node_modules/@stdlib/assert-is-object-like/lib/index.js","../node_modules/@stdlib/utils-type-of/lib/index.js","../node_modules/@stdlib/utils-type-of/lib/check.js","../node_modules/@stdlib/utils-type-of/lib/polyfill.js","../node_modules/@stdlib/utils-type-of/lib/main.js","../node_modules/@stdlib/assert-is-function/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/primitive.js","../node_modules/@stdlib/assert-is-string/lib/valueof.js","../node_modules/@stdlib/assert-is-string/lib/object.js","../node_modules/@stdlib/assert-is-string/lib/try2valueof.js","../node_modules/@stdlib/assert-is-string/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/index.js","../node_modules/@stdlib/assert-is-string-array/lib/index.js","../node_modules/@stdlib/assert-has-iterator-symbol-support/lib/main.js","../node_modules/@stdlib/symbol-iterator/lib/main.js","../node_modules/@stdlib/utils-define-nonenumerable-read-only-accessor/lib/main.js","../node_modules/@stdlib/assert-is-uint8array/lib/main.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/uint8array.js","../node_modules/@stdlib/array-uint8/lib/main.js","../node_modules/@stdlib/array-uint8/lib/index.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/main.js","../node_modules/@stdlib/array-uint8/lib/polyfill.js","../node_modules/@stdlib/array-base-getter/lib/main.js","../node_modules/@stdlib/array-base-accessor-getter/lib/main.js","../node_modules/@stdlib/error-tools-fmtprodmsg/lib/main.js","../lib/from_iterator.js","../lib/main.js","../lib/from_array.js","../lib/from_iterator_map.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' ); // NOTE: we inline the `isNumber.isPrimitive` function from `@stdlib/assert/is-number` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// FUNCTIONS //\n\n/**\n* Tests if a string starts with a minus sign (`-`).\n*\n* @private\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string starts with a minus sign (`-`)\n*/\nfunction startsWithMinus( str ) {\n\treturn str[ 0 ] === '-';\n}\n\n/**\n* Returns a string of `n` zeros.\n*\n* @private\n* @param {number} n - number of zeros\n* @returns {string} string of zeros\n*/\nfunction zeros( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += '0';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with zeros to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction zeroPad( str, width, right ) {\n\tvar negative = false;\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tif ( startsWithMinus( str ) ) {\n\t\tnegative = true;\n\t\tstr = str.substr( 1 );\n\t}\n\tstr = ( right ) ?\n\t\tstr + zeros( pad ) :\n\t\tzeros( pad ) + str;\n\tif ( negative ) {\n\t\tstr = '-' + str;\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default zeroPad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isNumber from './is_number.js';\nimport zeroPad from './zero_pad.js';\n\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as an integer.\n*\n* @private\n* @param {Object} token - token object\n* @throws {Error} must provide a valid integer\n* @returns {string} formatted token argument\n*/\nfunction formatInteger( token ) {\n\tvar base;\n\tvar out;\n\tvar i;\n\n\tswitch ( token.specifier ) {\n\tcase 'b':\n\t\t// Case: %b (binary)\n\t\tbase = 2;\n\t\tbreak;\n\tcase 'o':\n\t\t// Case: %o (octal)\n\t\tbase = 8;\n\t\tbreak;\n\tcase 'x':\n\tcase 'X':\n\t\t// Case: %x, %X (hexadecimal)\n\t\tbase = 16;\n\t\tbreak;\n\tcase 'd':\n\tcase 'i':\n\tcase 'u':\n\tdefault:\n\t\t// Case: %d, %i, %u (decimal)\n\t\tbase = 10;\n\t\tbreak;\n\t}\n\tout = token.arg;\n\ti = parseInt( out, 10 );\n\tif ( !isFinite( i ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\tif ( !isNumber( out ) ) {\n\t\t\tthrow new Error( 'invalid integer. Value: ' + out );\n\t\t}\n\t\ti = 0;\n\t}\n\tif ( i < 0 && ( token.specifier === 'u' || base !== 10 ) ) {\n\t\ti = 0xffffffff + i + 1;\n\t}\n\tif ( i < 0 ) {\n\t\tout = ( -i ).toString( base );\n\t\tif ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tout = '-' + out;\n\t} else {\n\t\tout = i.toString( base );\n\t\tif ( !i && !token.precision ) {\n\t\t\tout = '';\n\t\t} else if ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tif ( token.sign ) {\n\t\t\tout = token.sign + out;\n\t\t}\n\t}\n\tif ( base === 16 ) {\n\t\tif ( token.alternate ) {\n\t\t\tout = '0x' + out;\n\t\t}\n\t\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\t\tuppercase.call( out ) :\n\t\t\tlowercase.call( out );\n\t}\n\tif ( base === 8 ) {\n\t\tif ( token.alternate && out.charAt( 0 ) !== '0' ) {\n\t\t\tout = '0' + out;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar abs = Math.abs; // eslint-disable-line stdlib/no-builtin-math\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\nvar replace = String.prototype.replace;\n\n\n// VARIABLES //\n\nvar RE_EXP_POS_DIGITS = /e\\+(\\d)$/;\nvar RE_EXP_NEG_DIGITS = /e-(\\d)$/;\nvar RE_ONLY_DIGITS = /^(\\d+)$/;\nvar RE_DIGITS_BEFORE_EXP = /^(\\d+)e/;\nvar RE_TRAILING_PERIOD_ZERO = /\\.0$/;\nvar RE_PERIOD_ZERO_EXP = /\\.0*e/;\nvar RE_ZERO_BEFORE_EXP = /(\\..*[^0])0*e/;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as a floating-point number.\n*\n* @private\n* @param {number} f - parsed number\n* @param {Object} token - token object\n* @throws {Error} must provide a valid floating-point number\n* @returns {string} formatted token argument\n*/\nfunction formatDouble( f, token ) {\n\tvar digits;\n\tvar out;\n\n\tswitch ( token.specifier ) {\n\tcase 'e':\n\tcase 'E':\n\t\tout = f.toExponential( token.precision );\n\t\tbreak;\n\tcase 'f':\n\tcase 'F':\n\t\tout = f.toFixed( token.precision );\n\t\tbreak;\n\tcase 'g':\n\tcase 'G':\n\t\tif ( abs( f ) < 0.0001 ) {\n\t\t\tdigits = token.precision;\n\t\t\tif ( digits > 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport isNumber from './is_number.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar f;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\tf = parseFloat( token.arg );\n\t\t\t\tif ( !isFinite( f ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\t\t\t\tif ( !isNumber( token.arg ) ) {\n\t\t\t\t\t\tthrow new Error( 'invalid floating-point number. Value: ' + out );\n\t\t\t\t\t}\n\t\t\t\t\t// Case: NaN, Infinity, or -Infinity\n\t\t\t\t\tf = token.arg;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( f, token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\t// Check for an escaped percent sign `%%`...\n\t\tif ( match[ 6 ] === '%' ) {\n\t\t\ttokens.push( '%' );\n\t\t} else {\n\t\t\ttokens.push( parse( match ) );\n\t\t}\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Return a string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// EXPORTS //\n\nexport default Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Number from '@stdlib/number-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* import isNumber from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* import FLOAT64_PINF from '@stdlib/constants-float64-pinf';\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* import FLOAT64_NINF from '@stdlib/constants-float64-ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nexport default FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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';\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 PINF from '@stdlib/constants-float64-pinf';\nimport NINF from '@stdlib/constants-float64-ninf';\nimport isInt from '@stdlib/math-base-assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* import isInteger from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* import { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* import { isObject as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* import isNonNegativeInteger from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* import MAX_TYPED_ARRAY_LENGTH from '@stdlib/constants-array-max-typed-array-length';\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nexport default MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-array-max-typed-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasArrayBuffer = ( typeof ArrayBuffer === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an ArrayBuffer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an ArrayBuffer\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var bool = isArrayBuffer( new ArrayBuffer( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isArrayBuffer( [] );\n* // returns false\n*/\nfunction isArrayBuffer( value ) {\n\treturn (\n\t\t( hasArrayBuffer && value instanceof ArrayBuffer ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object ArrayBuffer]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArrayBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nexport default f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isArray from '@stdlib/assert-is-array';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar RE = /./;\n\n\n// EXPORTS //\n\nexport default RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 boolean.\n*\n* @name Boolean\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {(boolean|Boolean)} boolean\n*\n* @example\n* var b = Boolean( null );\n* // returns false\n*\n* b = Boolean( [] );\n* // returns true\n*\n* b = Boolean( {} );\n* // returns true\n*\n* @example\n* var b = new Boolean( false );\n* // returns \n*/\nvar Bool = Boolean; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Boolean from '@stdlib/boolean-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import isBoolean from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isObject as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 obj = ( typeof globalThis === 'object' ) ? globalThis : null; // eslint-disable-line no-undef\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 getGlobal from '@stdlib/utils-global';\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nexport default nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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/string-format';\nimport getThis from './codegen.js';\nimport Self from './self.js';\nimport Win from './window.js';\nimport GlobalThis from './global_this.js';\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @private\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a boolean. Value: `%s`.', codegen ) );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: 2020 revision of ECMAScript standard\n\tif ( GlobalThis ) {\n\t\treturn GlobalThis;\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func, stdlib/require-globals\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nexport default reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 reFunctionName from './main.js';\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nexport default RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isArray from '@stdlib/assert-is-array';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* import isOdd from '@stdlib/assert-is-odd';\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', predicate ) );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\nimport { REGEXP as RE } from '@stdlib/regexp-function-name';\nimport isBuffer from '@stdlib/assert-is-buffer';\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nexport default constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isObjectLike from '@stdlib/assert-is-object-like';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* import reFunctionName from '@stdlib/regexp-function-name';\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* import isObjectLike from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* import { isObjectLikeArray as isObjectLike } from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-function';\nimport main from './main.js';\n\n\n// VARIABLES //\n\nvar isObjectLikeArray = arrayfun( main );\n\n\n// MAIN //\n\nsetReadOnly( main, 'isObjectLikeArray', isObjectLikeArray );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* import typeOf from '@stdlib/utils-type-of';\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nimport usePolyfill from './check.js';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : builtin;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 RE from './fixtures/re.js';\nimport nodeList from './fixtures/nodelist.js';\nimport typedarray from './fixtures/typedarray.js';\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 ctorName from '@stdlib/utils-constructor-name';\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 ctorName from '@stdlib/utils-constructor-name';\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 typeOf from '@stdlib/utils-type-of';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nexport default isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nexport default valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport test from './try2valueof.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 valueOf from './valueof.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* import isString from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* import { isObject as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* import { isPrimitive as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is an array of strings.\n*\n* @module @stdlib/assert-is-string-array\n*\n* @example\n* import isStringArray from '@stdlib/assert-is-string-array';\n*\n* var bool = isStringArray( [ 'abc', 'def' ] );\n* // returns true\n*\n* bool = isStringArray( [ 'abc', 123 ] );\n* // returns false\n*\n* @example\n* import { primitives as isStringArray } from '@stdlib/assert-is-string-array';\n*\n* var bool = isStringArray( [ 'abc', 'def' ] );\n* // returns true\n*\n* bool = isStringArray( [ 'abc', new String( 'def' ) ] );\n* // returns false\n*\n* @example\n* import { objects as isStringArray } from '@stdlib/assert-is-string-array';\n*\n* var bool = isStringArray( [ new String( 'abc' ), new String( 'def' ) ] );\n* // returns true\n*\n* bool = isStringArray( [ new String( 'abc' ), 'def' ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-function';\nimport isString from '@stdlib/assert-is-string';\n\n\n// VARIABLES //\n\nvar isPrimitiveArray = arrayfun( isString.isPrimitive );\nvar isObjectArray = arrayfun( isString.isObject );\n\n\n// MAIN //\n\nvar isStringArray = arrayfun( isString );\nsetReadOnly( isStringArray, 'primitives', isPrimitiveArray );\nsetReadOnly( isStringArray, 'objects', isObjectArray );\n\n\n// EXPORTS //\n\nexport default isStringArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasOwnProp from '@stdlib/assert-has-own-property';\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.iterator` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.iterator` support\n*\n* @example\n* var bool = hasIteratorSymbolSupport();\n* // returns \n*/\nfunction hasIteratorSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol' &&\n\t\thasOwnProp( Symbol, 'iterator' ) &&\n\t\ttypeof Symbol.iterator === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasIteratorSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\n\n\n// MAIN //\n\n/**\n* Iterator symbol.\n*\n* @name IteratorSymbol\n* @constant\n* @type {(symbol|null)}\n*\n* @example\n* function iterator() {\n* var it;\n* var i;\n*\n* i = -1;\n*\n* it = {};\n* it.next = next;\n* it.return = done;\n*\n* if ( IteratorSymbol ) {\n* it[ IteratorSymbol ] = iterator;\n* }\n* return it;\n*\n* function next() {\n* i += 1;\n* return {\n* 'value': i,\n* 'done': false\n* };\n* }\n*\n* function done( value ) {\n* if ( arguments.length === 0 ) {\n* return {\n* 'done': true\n* };\n* }\n* return {\n* 'value': value,\n* 'done': true\n* };\n* }\n* }\n*\n* var obj = iterator();\n*/\nvar IteratorSymbol = ( hasIteratorSymbolSupport() ) ? Symbol.iterator : null;\n\n\n// EXPORTS //\n\nexport default IteratorSymbol;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - accessor\n*\n* @example\n* function getter() {\n* return 'bar';\n* }\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnlyAccessor( obj, 'foo', getter );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnlyAccessor( obj, prop, getter ) { // eslint-disable-line id-length\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'get': getter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnlyAccessor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* import ctor from '@stdlib/array-uint8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ArraySupport from '@stdlib/assert-has-uint8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isUint8Array from '@stdlib/assert-is-uint8array';\nimport UINT8_MAX from '@stdlib/constants-uint8-max';\nimport GlobalUint8Array from './uint8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar GETTERS = {\n\t'float64': getFloat64,\n\t'float32': getFloat32,\n\t'int32': getInt32,\n\t'int16': getInt16,\n\t'int8': getInt8,\n\t'uint32': getUint32,\n\t'uint16': getUint16,\n\t'uint8': getUint8,\n\t'uint8c': getUint8c,\n\t'generic': getGeneric,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var arr = new Float64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat64( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat64( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float32Array from '@stdlib/array-float32';\n*\n* var arr = new Float32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat32( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat32( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int32Array from '@stdlib/array-int32';\n*\n* var arr = new Int32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt32( arr, 2 );\n* // returns 3\n*/\nfunction getInt32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int16Array from '@stdlib/array-int16';\n*\n* var arr = new Int16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt16( arr, 2 );\n* // returns 3\n*/\nfunction getInt16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int8Array from '@stdlib/array-int8';\n*\n* var arr = new Int8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt8( arr, 2 );\n* // returns 3\n*/\nfunction getInt8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint32Array from '@stdlib/array-uint32';\n*\n* var arr = new Uint32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint32( arr, 2 );\n* // returns 3\n*/\nfunction getUint32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint16Array from '@stdlib/array-uint16';\n*\n* var arr = new Uint16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint16( arr, 2 );\n* // returns 3\n*/\nfunction getUint16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var arr = new Uint8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8( arr, 2 );\n* // returns 3\n*/\nfunction getUint8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array-uint8c';\n*\n* var arr = new Uint8ClampedArray( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8c( arr, 2 );\n* // returns 3\n*/\nfunction getUint8c( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a generic `Array`.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getGeneric( arr, 2 );\n* // returns 3\n*/\nfunction getGeneric( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an indexed array-like object.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an indexed array-like object.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 2 );\n* // returns 3\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar GETTERS = {\n\t'complex128': getComplex128,\n\t'complex64': getComplex64,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex128( arr, 1 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction getComplex128( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex64( arr, 1 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction getComplex64( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from an array-like object supporting the get/set protocol.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* function get( idx ) {\n* return arr[ idx ];\n* }\n*\n* function set( value, idx ) {\n* arr[ idx ] = value;\n* }\n*\n* arr.get = get;\n* arr.set = set;\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an array-like object supporting the get/set protocol.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 1 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {Array} output array\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tout.push( Boolean( v.value ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\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 isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport { primitives as isStringArray } from '@stdlib/assert-is-string-array';\nimport hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\nimport ITERATOR_SYMBOL from '@stdlib/symbol-iterator';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport Uint8Array from '@stdlib/array-uint8';\nimport Boolean from '@stdlib/boolean-ctor';\nimport getter from '@stdlib/array-base-getter';\nimport floor from '@stdlib/math-base-special-floor';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\nimport fromArray from './from_array.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Uint8Array.BYTES_PER_ELEMENT;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a `BooleanArray`.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `BooleanArray`\n*/\nfunction isBooleanArray( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'BooleanArray' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a boolean typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean typed array constructor\n*/\nfunction isBooleanArrayConstructor( value ) {\n\treturn ( value === BooleanArray );\n}\n\n\n// MAIN //\n\n/**\n* Boolean array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {TypeError} if provided only a single argument, must provide a valid argument\n* @throws {TypeError} byte offset must be a nonnegative integer\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = new BooleanArray();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new BooleanArray( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new BooleanArray( [ true, false ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 16\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 8\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new BooleanArray( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction BooleanArray() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\tvar arg;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof BooleanArray) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new BooleanArray();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new BooleanArray( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new BooleanArray( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new BooleanArray( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Uint8Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\targ = arguments[ 0 ];\n\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\tbuf = new Uint8Array( arg );\n\t\t} else if ( isCollection( arg ) ) {\n\t\t\tbuf = fromArray( new Uint8Array( arg.length ), arg );\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tbuf = new Uint8Array( arg );\n\t\t} else if ( isObject( arg ) ) {\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'null29', arg ) );\n\t\t\t}\n\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2A', arg ) );\n\t\t\t}\n\t\t\tbuf = arg[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2A', arg ) );\n\t\t\t}\n\t\t\tbuf = new Uint8Array( fromIterator( buf ) );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'null2A', arg ) );\n\t\t}\n\t} else {\n\t\tbuf = arguments[ 0 ];\n\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\tthrow new TypeError( format( 'null2B', buf ) );\n\t\t}\n\t\tbyteOffset = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'null2C', byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tbuf = new Uint8Array( buf, byteOffset );\n\t\t} else {\n\t\t\tlen = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2F', len ) );\n\t\t\t}\n\t\t\tif ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) {\n\t\t\t\tthrow new RangeError( format( 'null2G', len*BYTES_PER_ELEMENT ) );\n\t\t\t}\n\t\t\tbuf = new Uint8Array( buf, byteOffset, len );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof BooleanArray\n* @readonly\n* @type {PositiveInteger}\n* @default 1\n*\n* @example\n* var nbytes = BooleanArray.BYTES_PER_ELEMENT;\n* // returns 1\n*/\nsetReadOnly( BooleanArray, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof BooleanArray\n* @readonly\n* @type {string}\n* @default 'BooleanArray'\n*\n* @example\n* var str = BooleanArray.name;\n* // returns 'BooleanArray'\n*/\nsetReadOnly( BooleanArray, 'name', 'BooleanArray' );\n\n/**\n* Creates a new boolean array from an array-like object or an iterable.\n*\n* @name from\n* @memberof BooleanArray\n* @type {Function}\n* @param {(Collection|Iterable)} src - array-like object or iterable\n* @param {Function} [clbk] - callback to invoke for each source element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = BooleanArray.from( [ true, false ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* function clbk( v ) {\n* return !v;\n* }\n*\n* var arr = BooleanArray.from( [ true, false ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( BooleanArray, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\n\tvar get;\n\tvar len;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( format('null01') );\n\t}\n\tif ( !isBooleanArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'null2H', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\tlen = src.length;\n\t\t\tif ( src.get && src.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tbuf[ i ] = Boolean( clbk.call( thisArg, get( src, i ), i ) );\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( buf.next ) ) {\n\t\t\tthrow new TypeError( format( 'null2J', src ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIterator( buf );\n\t\t}\n\t\tlen = tmp.length;\n\t\tout = new this( len );\n\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tbuf[ i ] = tmp[ i ];\n\t\t}\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'null2J', src ) );\n});\n\n/**\n* Creates a new boolean array from a variable number of arguments.\n*\n* @name of\n* @memberof BooleanArray\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = BooleanArray.of( true, true, true, true );\n* // returns \n*\n* var len = arr.length;\n* // returns 4\n*/\nsetReadOnly( BooleanArray, 'of', function of() {\n\tvar args;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( format('null01') );\n\t}\n\tif ( !isBooleanArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\targs = [];\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn new this( args );\n});\n\n/**\n* Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} must provide an integer\n* @returns {(boolean|void)} array element\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.at( 0 );\n* // returns true\n*\n* v = arr.at( -1 );\n* // returns true\n*\n* v = arr.at( 100 );\n* // returns undefined\n*/\nsetReadOnly( BooleanArray.prototype, 'at', function at( idx ) {\n\tvar buf;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'null8A', idx ) );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tif ( idx < 0 ) {\n\t\tidx += len;\n\t}\n\tif ( idx < 0 || idx >= len ) {\n\t\treturn;\n\t}\n\treturn Boolean( buf[ idx ] );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'buffer', function get() {\n\treturn this._buffer.buffer;\n});\n\n/**\n* Size (in bytes) of the array.\n*\n* @name byteLength\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 10\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'byteLength', function get() {\n\treturn this._buffer.byteLength;\n});\n\n/**\n* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n*\n* @name byteOffset\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'byteOffset', function get() {\n\treturn this._buffer.byteOffset;\n});\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 1\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 1\n*/\nsetReadOnly( BooleanArray.prototype, 'BYTES_PER_ELEMENT', BooleanArray.BYTES_PER_ELEMENT );\n\n/**\n* Copies a sequence of elements within the array to the position starting at `target`.\n*\n* @name copyWithin\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} target - index at which to start copying elements\n* @param {integer} start - source index at which to copy elements from\n* @param {integer} [end] - source index at which to stop copying elements from\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} modified array\n*\n* @example\n* var arr = new BooleanArray( 4 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n* arr.set( true, 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* var v = arr.get( 2 );\n* // returns true\n*\n* v = arr.get( 3 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\t// FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled\n\tif ( arguments.length === 2 ) {\n\t\tthis._buffer.copyWithin( target, start );\n\t} else {\n\t\tthis._buffer.copyWithin( target, start, arguments[2] );\n\t}\n\treturn this;\n});\n\n/**\n* Returns an iterator for iterating over array key-value pairs.\n*\n* @name entries\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var it = arr.entries();\n*\n* var v = it.next().value;\n* // returns [ 0, true ]\n*\n* v = it.next().value;\n* // returns [ 1, false ]\n*\n* v = it.next().value;\n* // returns [ 2, true ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'entries', function entries() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar buf;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tbuf = this._buffer;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': [ i, Boolean( buf[ i ] ) ],\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.entries();\n\t}\n});\n\n/**\n* Tests whether all elements in an array pass a test implemented by a predicate function.\n*\n* @name every\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether all elements pass a test\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( true, 1 );\n* arr.set( true, 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( !predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n});\n\n/**\n* Returns a modified typed array filled with a fill value.\n*\n* @name fill\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} value - fill value\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {BooleanArray} modified array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.fill( true, 1 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* v = arr.get( 1 );\n* // returns true\n*\n* v = arr.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar val;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', value ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2z', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t} else {\n\t\t\tend = len;\n\t\t}\n\t} else {\n\t\tstart = 0;\n\t\tend = len;\n\t}\n\tif ( value ) {\n\t\tval = 1;\n\t} else {\n\t\tval = 0;\n\t}\n\tfor ( i = start; i < end; i++ ) {\n\t\tbuf[ i ] = val;\n\t}\n\treturn this;\n});\n\n/**\n* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.\n*\n* @name filter\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} boolean array\n*\n* @example\n* function predicate( v ) {\n* return ( v === true );\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 2\n*\n* var v = out.get( 0 );\n* // returns true\n*\n* v = out.get( 1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\tout.push( v );\n\t\t}\n\t}\n\treturn new this.constructor( out );\n});\n\n/**\n* Returns the first element in an array for which a predicate function returns a truthy value.\n*\n* @name find\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {(boolean|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.find( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn v;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the first element in an array for which a predicate function returns a truthy value.\n*\n* @name findIndex\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findIndex( predicate );\n* // returns 0\n*/\nsetReadOnly( BooleanArray.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLast\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {(boolean|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findLast( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn v;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLastIndex\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findLastIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Invokes a function once for each array element.\n*\n* @name forEach\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( BooleanArray.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'null3c', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tfcn.call( thisArg, Boolean( buf[ i ] ), i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(boolean|void)} array element\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* arr.set( [ true, false ], 0 );\n*\n* v = arr.get( 0 );\n* // returns true\n*\n* v = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( BooleanArray.prototype, 'get', function get( idx ) {\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isNonNegativeInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'null2K', idx ) );\n\t}\n\tif ( idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn Boolean( this._buffer[ idx ] );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a value\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( true, 3 );\n* arr.set( true, 4 );\n*\n* var bool = arr.includes( true );\n* // returns true\n*\n* bool = arr.includes( false, 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @name indexOf\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( true, 3 );\n* arr.set( true, 4 );\n*\n* var idx = arr.indexOf( true );\n* // returns 0\n*\n* idx = arr.indexOf( false, 2 );\n* // returns -1\n*\n* idx = arr.indexOf( false, -3 );\n* // returns -1\n*/\nsetReadOnly( BooleanArray.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new string by concatenating all array elements.\n*\n* @name join\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.join();\n* // returns 'true,false,true'\n*\n* str = arr.join( '|' );\n* // returns 'true|false|true'\n*/\nsetReadOnly( BooleanArray.prototype, 'join', function join( separator ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( arguments.length > 0 ) {\n\t\tif ( !isString( separator ) ) {\n\t\t\tthrow new TypeError( format( 'null3F', separator ) );\n\t\t}\n\t} else {\n\t\tseparator = ',';\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( buf[i] ) {\n\t\t\tout.push( 'true' );\n\t\t} else {\n\t\t\tout.push( 'false' );\n\t\t}\n\t}\n\treturn out.join( separator );\n});\n\n/**\n* Returns an iterator for iterating over each index key in a typed array.\n*\n* @name keys\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 2 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n*\n* var iter = arr.keys();\n*\n* var v = iter.next().value;\n* // returns 0\n*\n* v = iter.next().value;\n* // returns 1\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': i,\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.keys();\n\t}\n});\n\n/**\n* Returns the last index at which a given element can be found.\n*\n* @name lastIndexOf\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( true, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var idx = arr.lastIndexOf( true );\n* // returns 4\n*\n* idx = arr.lastIndexOf( false, 2 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( false, -3 );\n* // returns -1\n*/\nsetReadOnly( BooleanArray.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= this._length ) {\n\t\t\tfromIndex = this._length - 1;\n\t\t} else if ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t}\n\t} else {\n\t\tfromIndex = this._length - 1;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a new array with each element being the result of a provided callback function.\n*\n* @name map\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} new boolean array\n*\n* @example\n* function invert( v ) {\n* return !v;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.map( invert );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns false\n*\n* z = out.get( 1 );\n* // returns true\n*\n* z = out.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format('null3c'), fcn );\n\t}\n\tbuf = this._buffer;\n\tout = new this.constructor( this._length );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\toutbuf[ i ] = Boolean( fcn.call( thisArg, Boolean( buf[ i ] ), i, this ) );\n\t}\n\treturn out;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduce\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* function reducer( acc, v ) {\n* if ( v ) {\n* return acc + 1;\n* }\n* return acc;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.reduce( reducer, 0 );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'null3c', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = 0;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = Boolean( buf[ 0 ] );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tacc = reducer( acc, Boolean( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in reverse order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduceRight\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* function reducer( acc, v ) {\n* if ( v ) {\n* return acc + 1;\n* }\n* return acc;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.reduceRight( reducer, 0 );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'null3c', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = len - 1;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = Boolean( buf[ len-1 ] );\n\t\ti = len - 2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tacc = reducer( acc, Boolean( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} reversed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*\n* v = out.get( 1 );\n* // returns false\n*\n* v = out.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ i ];\n\t\tbuf[ i ] = buf[ j ];\n\t\tbuf[ j ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n*\n* In the other overlapping scenario,\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended.\n*\n* @name set\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {(Collection|BooleanArray|*)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n* @returns {void}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* arr.set( [ true, false ], 0 );\n*\n* v = arr.get( 0 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'set', function set( value ) {\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length > 1 ) {\n\t\tidx = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'null2L', idx ) );\n\t\t}\n\t} else {\n\t\tidx = 0;\n\t}\n\tif ( isCollection( value ) ) {\n\t\tN = value.length;\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( format('null03') );\n\t\t}\n\t\tif ( isBooleanArray( value ) ) {\n\t\t\tsbuf = value._buffer; // eslint-disable-line no-underscore-dangle\n\t\t} else {\n\t\t\tsbuf = value;\n\t\t}\n\t\t// Check for overlapping memory...\n\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\tif (\n\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t(\n\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t)\n\t\t) {\n\t\t\t// We need to copy source values...\n\t\t\ttmp = new Uint8Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\tbuf[ idx ] = ( sbuf[ i ] ) ? 1 : 0;\n\t\t}\n\t\treturn;\n\t}\n\tif ( idx >= this._length ) {\n\t\tthrow new RangeError( format( 'null2M', idx ) );\n\t}\n\tbuf[ idx ] = ( value ) ? 1 : 0;\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} [begin] - start index (inclusive)\n* @param {integer} [end] - end index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be integer\n* @throws {TypeError} second argument must be integer\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var bool = out.get( 0 );\n* // returns true\n*\n* bool = out.get( len-1 );\n* // returns true\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* bool = out.get( 0 );\n* // returns false\n*\n* bool = out.get( len-1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'slice', function slice( begin, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar len;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'null7e', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'null7f', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin < end ) {\n\t\toutlen = end - begin;\n\t} else {\n\t\toutlen = 0;\n\t}\n\tout = new this.constructor( outlen );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < outlen; i++ ) {\n\t\toutbuf[ i ] = buf[ i+begin ];\n\t}\n\treturn out;\n});\n\n/**\n* Tests whether at least one element in an array passes a test implemented by a predicate function.\n*\n* @name some\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether at least one element passes a test\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( false, 0 );\n* arr.set( true, 1 );\n* arr.set( false, 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Sorts an array in-place.\n*\n* @name sort\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a === false ) {\n* if ( b === false ) {\n* return 0;\n* }\n* return 1;\n* }\n* if ( b === true ) {\n* return 0;\n* }\n* return -1;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* arr.sort( compare );\n*\n* var v = arr.get( 0 );\n* // returns true\n*\n* v = arr.get( 1 );\n* // returns true\n*\n* v = arr.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'sort', function sort( compareFcn ) {\n\tvar buf;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length === 0 ) {\n\t\tbuf.sort();\n\t\treturn this;\n\t}\n\tif ( !isFunction( compareFcn ) ) {\n\t\tthrow new TypeError( format( 'null3c', compareFcn ) );\n\t}\n\tbuf.sort( compare );\n\treturn this;\n\n\t/**\n\t* Comparison function for sorting.\n\t*\n\t* @private\n\t* @param {boolean} a - first boolean value for comparison\n\t* @param {boolean} b - second boolean value for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( Boolean( a ), Boolean( b ) );\n\t}\n});\n\n/**\n* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.\n*\n* @name subarray\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} [begin] - start index (inclusive)\n* @param {integer} [end] - end index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {BooleanArray} subarray\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var bool = subarr.get( 0 );\n* // returns true\n*\n* bool = subarr.get( len-1 );\n* // returns true\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* bool = subarr.get( 0 );\n* // returns false\n*\n* bool = subarr.get( len-1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'null7e', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'null7f', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin >= len ) {\n\t\tlen = 0;\n\t\toffset = buf.byteLength;\n\t} else if ( begin >= end ) {\n\t\tlen = 0;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t} else {\n\t\tlen = end - begin;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t}\n\treturn new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len );\n});\n\n/**\n* Serializes an array as a locale-specific string.\n*\n* @name toLocaleString\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {(string|Array)} [locales] - locale identifier(s)\n* @param {Object} [options] - configuration options\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a string or an array of strings\n* @throws {TypeError} options argument must be an object\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.toLocaleString();\n* // returns 'true,false,true'\n*/\nsetReadOnly( BooleanArray.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tloc = [];\n\t} else if ( isString( locales ) || isStringArray( locales ) ) {\n\t\tloc = locales;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string or an array of strings. Value: `%s`.', locales ) );\n\t}\n\tif ( arguments.length < 2 ) {\n\t\topts = {};\n\t} else if ( isObject( options ) ) {\n\t\topts = options;\n\t} else {\n\t\tthrow new TypeError( format( 'null2V', options ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( Boolean( buf[ i ] ).toLocaleString( loc, opts ) );\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} reversed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*\n* v = out.get( 1 );\n* // returns false\n*\n* v = out.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\toutbuf[ i ] = buf[ len - i - 1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Returns a new typed array containing the elements in sorted order.\n*\n* @name toSorted\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a === false ) {\n* if ( b === false ) {\n* return 0;\n* }\n* return 1;\n* }\n* if ( b === true ) {\n* return 0;\n* }\n* return -1;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.sort( compare );\n* // returns \n*\n* var v = out.get( 0 );\n* // returns true\n*\n* v = out.get( 1 );\n* // returns true\n*\n* v = out.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\toutbuf[ i ] = buf[ i ];\n\t}\n\tif ( arguments.length === 0 ) {\n\t\toutbuf.sort();\n\t\treturn out;\n\t}\n\tif ( !isFunction( compareFcn ) ) {\n\t\tthrow new TypeError( format( 'null3c', compareFcn ) );\n\t}\n\toutbuf.sort( compare );\n\treturn out;\n\n\t/**\n\t* Comparison function for sorting.\n\t*\n\t* @private\n\t* @param {boolean} a - first boolean value for comparison\n\t* @param {boolean} b - second boolean value for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( Boolean( a ), Boolean( b ) );\n\t}\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.toString();\n* // returns 'true,false,true'\n*/\nsetReadOnly( BooleanArray.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( buf[i] ) {\n\t\t\tout.push( 'true' );\n\t\t} else {\n\t\t\tout.push( 'false' );\n\t\t}\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns an iterator for iterating over each value in a typed array.\n*\n* @name values\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 2 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns true\n*\n* v = iter.next().value;\n* // returns false\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'values', function values() {\n\tvar iter;\n\tvar self;\n\tvar len;\n\tvar FLG;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tbuf = this._buffer;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': Boolean( buf[ i ] ),\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.values();\n\t}\n});\n\n/**\n* Returns a new typed array with the element at a provided index replaced with a provided value.\n*\n* @name with\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {boolean} value - new value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {TypeError} second argument must be a boolean\n* @returns {BooleanArray} new typed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.with( 0, false );\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isInteger( index ) ) {\n\t\tthrow new TypeError( format( 'null7e', index ) );\n\t}\n\tlen = this._length;\n\tif ( index < 0 ) {\n\t\tindex += len;\n\t}\n\tif ( index < 0 || index >= len ) {\n\t\tthrow new RangeError( format( 'nullFP', index ) );\n\t}\n\tif ( !isBoolean( value ) ) {\n\t\tthrow new TypeError( format( 'null55', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tif ( value ) {\n\t\tbuf[ index ] = 1;\n\t} else {\n\t\tbuf[ index ] = 0;\n\t}\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default BooleanArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Fills an output array with \"boolean\" values.\n*\n* @private\n* @param {Uint8Array} buf - output array\n* @param {Array} arr - input array\n* @returns {Uint8Array} output array\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar i;\n\n\tlen = arr.length;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tbuf[ i ] = Boolean( arr[ i ] );\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {Array} output array\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tout.push( Boolean( clbk.call( thisArg, v.value, i ) ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\n"],"names":["main","Object","defineProperty","isNumber","value","zeros","n","i","out","zeroPad","str","width","right","negative","pad","length","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","f","digits","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","parseFloat","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","push","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","defineProperty$1","setNonEnumerableReadOnly","configurable","enumerable","writable","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","nativeClass","hasToStringTag","v","isOwn","tag","main$3","Number","test","isPrimitive","isObject","setReadOnly","FLOAT64_PINF","POSITIVE_INFINITY","FLOAT64_NINF","NEGATIVE_INFINITY","floor","isInteger","x","PINF","NINF","isInt","valueOf","isNonNegativeInteger","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","hasArrayBuffer","ArrayBuffer","isArrayBuffer","main$2","isBoolean","Bool","Boolean","self","window","globalThis","root","codegen","Function","GlobalThis","Self","Win","getGlobal","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","arrayfcn","predicate","len","isObjectLike","constructorName","name","ctor","constructor","_isBuffer","isBuffer","REGEXP","arrayfun","ctorName","type","isFunction","typeOf","isString","isPrimitiveArray","isObjectArray","isStringArray","hasIteratorSymbolSupport","iterator","IteratorSymbol","setNonEnumerableReadOnlyAccessor","getter","hasUint8Array","Uint8Array","Uint8Array$1","bool","arr","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","GETTERS","float64","idx","float32","int32","int16","int8","uint32","uint16","uint8","uint8c","generic","default","complex128","complex64","fmtprodmsg","a","u","encodeURIComponent","fromIterator","it","next","done","BYTES_PER_ELEMENT","HAS_ITERATOR_SYMBOL","isBooleanArray","isBooleanArrayConstructor","BooleanArray","byteOffset","nargs","buf","this","fromArray","ITERATOR_SYMBOL","byteLength","RangeError","src","thisArg","clbk","tmp","dtype","accessorGetter","_buffer","fromIteratorMap","_length","buffer","target","start","copyWithin","iter","entries","end","val","fcn","searchElement","fromIndex","separator","join","keys","outbuf","reducer","initialValue","acc","N","sbuf","begin","outlen","compareFcn","sort","b","offset","locales","options","opts","loc","toLocaleString","values","index"],"mappings":";yCAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCjFA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAASC,EAAOC,GACf,IACIC,EADAC,EAAM,GAEV,IAAMD,EAAI,EAAGA,EAAID,EAAGC,IACnBC,GAAO,IAER,OAAOA,CACR,CAcA,SAASC,EAASC,EAAKC,EAAOC,GAC7B,IAAIC,GAAW,EACXC,EAAMH,EAAQD,EAAIK,OACtB,OAAKD,EAAM,IAnCZ,SAA0BJ,GACzB,MAAoB,MAAbA,EAAK,EACb,CAoCMM,CAAiBN,KACrBG,GAAW,EACXH,EAAMA,EAAIO,OAAQ,IAEnBP,EAAM,EACLA,EAAML,EAAOS,GACbT,EAAOS,GAAQJ,EACXG,IACJH,EAAM,IAAMA,IAVLA,CAaT,CCpDA,IAAIQ,EAAYC,OAAOC,UAAUC,YAC7BC,EAAYH,OAAOC,UAAUG,YAajC,SAASC,EAAeC,GACvB,IAAIC,EACAlB,EACAD,EAEJ,OAASkB,EAAME,WACf,IAAK,IAEJD,EAAO,EACP,MACD,IAAK,IAEJA,EAAO,EACP,MACD,IAAK,IACL,IAAK,IAEJA,EAAO,GACP,MAID,QAECA,EAAO,GAKR,GAFAlB,EAAMiB,EAAMG,IACZrB,EAAIsB,SAAUrB,EAAK,KACbsB,SAAUvB,GAAM,CACrB,IAAMJ,EAAUK,GACf,MAAM,IAAIuB,MAAO,2BAA6BvB,GAE/CD,EAAI,CACJ,CAkCD,OAjCKA,EAAI,IAA2B,MAApBkB,EAAME,WAA8B,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AAnF,EAAA8H,QACA,IAjDA3B,CAkDA,IA6BA1H,EAAAoG,GAAA3N,UAAA,QAAA,SAAA6Q,EAAA7R,GACA,IACAI,EACA6K,EAEA,IAAAwD,GAAAM,MACA,MAAA,IAAA7K,UAAA,sDAEA,IAAA2E,GAAAgJ,GACA,MAAA,IAAA3N,UAAAiB,GAAA,SAAA0M,IAMA,GAJA5G,EAAA8D,KAAAa,QACAiC,EAAA,IACAA,GAAA5G,GAEA4G,EAAA,GAAAA,GAAA5G,EACA,MAAA,IAAAkE,WAAAhK,GAAA,SAAA0M,IAEA,IAAAlI,GAAA3J,GACA,MAAA,IAAAkE,UAAAiB,GAAA,SAAAnF,IASA,OAPAI,EAAA,IAAA2O,KAAAzD,YAAAyD,KAAAW,UACAA,QAEAmC,GADA7R,EACA,EAEA,EAEAI,CACA","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 0b44231..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import ctor from '../docs/types/index'; -export = ctor; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index fd93057..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var d=function(o,r){return function(){try{return r||o((r={exports:{}}).exports,r),r.exports}catch(t){throw r=0,t}}};var F=d(function(tr,B){"use strict";var G=require("@stdlib/boolean-ctor");function C(o){var r,t;for(r=[];t=o.next(),!t.done;)r.push(G(t.value));return r}B.exports=C});var A=d(function(er,L){"use strict";var H=require("@stdlib/boolean-ctor");function U(o,r,t){var i,e,n;for(i=[],n=-1;e=o.next(),!e.done;)n+=1,i.push(H(r.call(t,e.value,n)));return i}L.exports=U});var R=d(function(ir,O){"use strict";var z=require("@stdlib/boolean-ctor");function D(o,r){var t,i;for(t=r.length,i=0;it.byteLength-o)throw new RangeError(f("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",i*E));t=new c(t,o,i)}}return s(this,"_buffer",t),s(this,"_length",t.length),this}s(u,"BYTES_PER_ELEMENT",E);s(u,"name","BooleanArray");s(u,"from",function(r){var t,i,e,n,a,l,g,p,w;if(!y(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!P(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(i=arguments.length,i>1){if(e=arguments[1],!y(e))throw new TypeError(f("invalid argument. Second argument must be a function. Value: `%s`.",e));i>2&&(t=arguments[2])}if(S(r)){if(e){for(p=r.length,r.get&&r.set?g=Z("default"):g=Q("default"),n=new this(p),a=n._buffer,w=0;w=i))return v(t[r])});V(u.prototype,"buffer",function(){return this._buffer.buffer});V(u.prototype,"byteLength",function(){return this._buffer.byteLength});V(u.prototype,"byteOffset",function(){return this._buffer.byteOffset});s(u.prototype,"BYTES_PER_ELEMENT",u.BYTES_PER_ELEMENT);s(u.prototype,"copyWithin",function(r,t){if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return arguments.length===2?this._buffer.copyWithin(r,t):this._buffer.copyWithin(r,t,arguments[2]),this});s(u.prototype,"entries",function(){var r,t,i,e,n,a;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return r=this,e=this._buffer,i=this._length,a=-1,t={},s(t,"next",l),s(t,"return",g),m&&s(t,m,p),t;function l(){return a+=1,n||a>=i?{done:!0}:{value:[a,v(e[a])],done:!1}}function g(w){return n=!0,arguments.length?{value:w,done:!0}:{done:!0}}function p(){return r.entries()}});s(u.prototype,"every",function(r,t){var i,e;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!y(r))throw new TypeError(f("invalid argument. First argument must be a function. Value: `%s`.",r));for(i=this._buffer,e=0;e1){if(!b(t))throw new TypeError(f("invalid argument. Second argument must be an integer. Value: `%s`.",t));if(t<0&&(t+=n,t<0&&(t=0)),arguments.length>2){if(!b(i))throw new TypeError(f("invalid argument. Third argument must be an integer. Value: `%s`.",i));i<0&&(i+=n,i<0&&(i=0)),i>n&&(i=n)}else i=n}else t=0,i=n;for(r?a=1:a=0,l=t;l=0;n--)if(e=v(i[n]),r.call(t,e,n,this))return e});s(u.prototype,"findLastIndex",function(r,t){var i,e,n;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!y(r))throw new TypeError(f("invalid argument. First argument must be a function. Value: `%s`.",r));for(i=this._buffer,n=this._length-1;n>=0;n--)if(e=v(i[n]),r.call(t,e,n,this))return n;return-1});s(u.prototype,"forEach",function(r,t){var i,e;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!y(r))throw new TypeError(f("invalid argument. First argument must be a function. Value: `%s`.",r));for(i=this._buffer,e=0;e=this._length))return v(this._buffer[r])});s(u.prototype,"includes",function(r,t){var i,e;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!_(r))throw new TypeError(f("invalid argument. First argument must be a boolean. Value: `%s`.",r));if(arguments.length>1){if(!b(t))throw new TypeError(f("invalid argument. Second argument must be an integer. Value: `%s`.",t));t<0&&(t+=this._length,t<0&&(t=0))}else t=0;for(i=this._buffer,e=t;e1){if(!b(t))throw new TypeError(f("invalid argument. Second argument must be an integer. Value: `%s`.",t));t<0&&(t+=this._length,t<0&&(t=0))}else t=0;for(i=this._buffer,e=t;e0){if(!j(r))throw new TypeError(f("invalid argument. First argument must be a string. Value: `%s`.",r))}else r=",";for(t=this._buffer,i=[],e=0;e=i?{done:!0}:{value:n,done:!1}}function l(p){return e=!0,arguments.length?{value:p,done:!0}:{done:!0}}function g(){return r.keys()}});s(u.prototype,"lastIndexOf",function(r,t){var i,e;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!_(r))throw new TypeError(f("invalid argument. First argument must be a boolean. Value: `%s`.",r));if(arguments.length>1){if(!b(t))throw new TypeError(f("invalid argument. Second argument must be an integer. Value: `%s`.",t));t>=this._length?t=this._length-1:t<0&&(t+=this._length)}else t=this._length-1;for(i=this._buffer,e=t;e>=0;e--)if(r===v(i[e]))return e;return-1});V(u.prototype,"length",function(){return this._length});s(u.prototype,"map",function(r,t){var i,e,n,a;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!y(r))throw new TypeError("invalid argument. First argument must be a function. Value: `%s`.",r);for(n=this._buffer,e=new this.constructor(this._length),i=e._buffer,a=0;a1)n=t,a=0;else{if(e===0)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=v(i[0]),a=1}for(;a1)n=t,a=e-1;else{if(e===0)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=v(i[e-1]),a=e-2}for(;a>=0;a--)n=r(n,v(i[a]),a,this);return n});s(u.prototype,"reverse",function(){var r,t,i,e,n,a;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(r=this._buffer,i=this._length,e=X(i/2),n=0;n1){if(i=arguments[1],!T(i))throw new TypeError(f("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",i))}else i=0;if(S(r)){if(a=r.length,i+a>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(h(r)?t=r._buffer:t=r,g=e.byteOffset+i*E,t.buffer===e.buffer&&t.byteOffsetg){for(n=new c(t.length),l=0;l=this._length)throw new RangeError(f("invalid argument. Index argument is out-of-bounds. Value: `%u`.",i));e[i]=r?1:0});s(u.prototype,"slice",function(r,t){var i,e,n,a,l,g;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(a=this._buffer,l=this._length,arguments.length===0)r=0,t=l;else{if(!b(r))throw new TypeError(f("invalid argument. First argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=l,r<0&&(r=0)),arguments.length===1)t=l;else{if(!b(t))throw new TypeError(f("invalid argument. Second argument must be an integer. Value: `%s`.",t));t<0?(t+=l,t<0&&(t=0)):t>l&&(t=l)}}for(rn&&(t=n)}}return r>=n?(n=0,i=e.byteLength):r>=t?(n=0,i=e.byteOffset+r*E):(n=t-r,i=e.byteOffset+r*E),new this.constructor(e.buffer,i,n<0?0:n)});s(u.prototype,"toLocaleString",function(r,t){var i,e,n,a,l;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(arguments.length===0)e=[];else if(j(r)||J(r))e=r;else throw new TypeError(f("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",r));if(arguments.length<2)i={};else if(q(t))i=t;else throw new TypeError(f("invalid argument. Options argument must be an object. Value: `%s`.",t));for(a=this._buffer,n=[],l=0;l=i?{done:!0}:{value:v(n[a]),done:!1}}function g(w){return e=!0,arguments.length?{value:w,done:!0}:{done:!0}}function p(){return t.values()}});s(u.prototype,"with",function(r,t){var i,e,n;if(!h(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!b(r))throw new TypeError(f("invalid argument. First argument must be an integer. Value: `%s`.",r));if(n=this._length,r<0&&(r+=n),r<0||r>=n)throw new RangeError(f("invalid argument. Index argument is out-of-bounds. Value: `%s`.",r));if(!_(t))throw new TypeError(f("invalid argument. Second argument must be a boolean. Value: `%s`.",t));return e=new this.constructor(this._buffer),i=e._buffer,t?i[r]=1:i[r]=0,e});Y.exports=u});var x=W();module.exports=x; -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 7a970c3..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/from_iterator.js", "../lib/from_iterator_map.js", "../lib/from_array.js", "../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Boolean = require( '@stdlib/boolean-ctor' );\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {Array} output array\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tout.push( Boolean( v.value ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIterator;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Boolean = require( '@stdlib/boolean-ctor' );\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {Array} output array\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tout.push( Boolean( clbk.call( thisArg, v.value, i ) ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIteratorMap;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Boolean = require( '@stdlib/boolean-ctor' );\n\n\n// MAIN //\n\n/**\n* Fills an output array with \"boolean\" values.\n*\n* @private\n* @param {Uint8Array} buf - output array\n* @param {Array} arr - input array\n* @returns {Uint8Array} output array\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar i;\n\n\tlen = arr.length;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tbuf[ i ] = Boolean( arr[ i ] );\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\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 isFunction = require( '@stdlib/assert-is-function' );\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isStringArray = require( '@stdlib/assert-is-string-array' ).primitives;\nvar hasIteratorSymbolSupport = require( '@stdlib/assert-has-iterator-symbol-support' );\nvar ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' );\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar Boolean = require( '@stdlib/boolean-ctor' );\nvar getter = require( '@stdlib/array-base-getter' );\nvar floor = require( '@stdlib/math-base-special-floor' );\nvar accessorGetter = require( '@stdlib/array-base-accessor-getter' );\nvar format = require( '@stdlib/string-format' );\nvar fromIterator = require( './from_iterator.js' );\nvar fromIteratorMap = require( './from_iterator_map.js' );\nvar fromArray = require( './from_array.js' );\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Uint8Array.BYTES_PER_ELEMENT;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a `BooleanArray`.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `BooleanArray`\n*/\nfunction isBooleanArray( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'BooleanArray' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a boolean typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean typed array constructor\n*/\nfunction isBooleanArrayConstructor( value ) {\n\treturn ( value === BooleanArray );\n}\n\n\n// MAIN //\n\n/**\n* Boolean array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {TypeError} if provided only a single argument, must provide a valid argument\n* @throws {TypeError} byte offset must be a nonnegative integer\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = new BooleanArray();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new BooleanArray( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new BooleanArray( [ true, false ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 16\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 8\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new BooleanArray( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction BooleanArray() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\tvar arg;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof BooleanArray) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new BooleanArray();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new BooleanArray( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new BooleanArray( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new BooleanArray( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Uint8Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\targ = arguments[ 0 ];\n\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\tbuf = new Uint8Array( arg );\n\t\t} else if ( isCollection( arg ) ) {\n\t\t\tbuf = fromArray( new Uint8Array( arg.length ), arg );\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tbuf = new Uint8Array( arg );\n\t\t} else if ( isObject( arg ) ) {\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tbuf = arg[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tbuf = new Uint8Array( fromIterator( buf ) );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t}\n\t} else {\n\t\tbuf = arguments[ 0 ];\n\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t\t}\n\t\tbyteOffset = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tbuf = new Uint8Array( buf, byteOffset );\n\t\t} else {\n\t\t\tlen = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) );\n\t\t\t}\n\t\t\tif ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len*BYTES_PER_ELEMENT ) );\n\t\t\t}\n\t\t\tbuf = new Uint8Array( buf, byteOffset, len );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof BooleanArray\n* @readonly\n* @type {PositiveInteger}\n* @default 1\n*\n* @example\n* var nbytes = BooleanArray.BYTES_PER_ELEMENT;\n* // returns 1\n*/\nsetReadOnly( BooleanArray, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof BooleanArray\n* @readonly\n* @type {string}\n* @default 'BooleanArray'\n*\n* @example\n* var str = BooleanArray.name;\n* // returns 'BooleanArray'\n*/\nsetReadOnly( BooleanArray, 'name', 'BooleanArray' );\n\n/**\n* Creates a new boolean array from an array-like object or an iterable.\n*\n* @name from\n* @memberof BooleanArray\n* @type {Function}\n* @param {(Collection|Iterable)} src - array-like object or iterable\n* @param {Function} [clbk] - callback to invoke for each source element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = BooleanArray.from( [ true, false ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* function clbk( v ) {\n* return !v;\n* }\n*\n* var arr = BooleanArray.from( [ true, false ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( BooleanArray, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\n\tvar get;\n\tvar len;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isBooleanArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\tlen = src.length;\n\t\t\tif ( src.get && src.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tbuf[ i ] = Boolean( clbk.call( thisArg, get( src, i ), i ) );\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( buf.next ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIterator( buf );\n\t\t}\n\t\tlen = tmp.length;\n\t\tout = new this( len );\n\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tbuf[ i ] = tmp[ i ];\n\t\t}\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n});\n\n/**\n* Creates a new boolean array from a variable number of arguments.\n*\n* @name of\n* @memberof BooleanArray\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = BooleanArray.of( true, true, true, true );\n* // returns \n*\n* var len = arr.length;\n* // returns 4\n*/\nsetReadOnly( BooleanArray, 'of', function of() {\n\tvar args;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isBooleanArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\targs = [];\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn new this( args );\n});\n\n/**\n* Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} must provide an integer\n* @returns {(boolean|void)} array element\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.at( 0 );\n* // returns true\n*\n* v = arr.at( -1 );\n* // returns true\n*\n* v = arr.at( 100 );\n* // returns undefined\n*/\nsetReadOnly( BooleanArray.prototype, 'at', function at( idx ) {\n\tvar buf;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tif ( idx < 0 ) {\n\t\tidx += len;\n\t}\n\tif ( idx < 0 || idx >= len ) {\n\t\treturn;\n\t}\n\treturn Boolean( buf[ idx ] );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'buffer', function get() {\n\treturn this._buffer.buffer;\n});\n\n/**\n* Size (in bytes) of the array.\n*\n* @name byteLength\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 10\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'byteLength', function get() {\n\treturn this._buffer.byteLength;\n});\n\n/**\n* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n*\n* @name byteOffset\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'byteOffset', function get() {\n\treturn this._buffer.byteOffset;\n});\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 1\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 1\n*/\nsetReadOnly( BooleanArray.prototype, 'BYTES_PER_ELEMENT', BooleanArray.BYTES_PER_ELEMENT );\n\n/**\n* Copies a sequence of elements within the array to the position starting at `target`.\n*\n* @name copyWithin\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} target - index at which to start copying elements\n* @param {integer} start - source index at which to copy elements from\n* @param {integer} [end] - source index at which to stop copying elements from\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} modified array\n*\n* @example\n* var arr = new BooleanArray( 4 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n* arr.set( true, 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* var v = arr.get( 2 );\n* // returns true\n*\n* v = arr.get( 3 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\t// FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled\n\tif ( arguments.length === 2 ) {\n\t\tthis._buffer.copyWithin( target, start );\n\t} else {\n\t\tthis._buffer.copyWithin( target, start, arguments[2] );\n\t}\n\treturn this;\n});\n\n/**\n* Returns an iterator for iterating over array key-value pairs.\n*\n* @name entries\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var it = arr.entries();\n*\n* var v = it.next().value;\n* // returns [ 0, true ]\n*\n* v = it.next().value;\n* // returns [ 1, false ]\n*\n* v = it.next().value;\n* // returns [ 2, true ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'entries', function entries() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar buf;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tbuf = this._buffer;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': [ i, Boolean( buf[ i ] ) ],\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.entries();\n\t}\n});\n\n/**\n* Tests whether all elements in an array pass a test implemented by a predicate function.\n*\n* @name every\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether all elements pass a test\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( true, 1 );\n* arr.set( true, 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( !predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n});\n\n/**\n* Returns a modified typed array filled with a fill value.\n*\n* @name fill\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} value - fill value\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {BooleanArray} modified array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.fill( true, 1 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* v = arr.get( 1 );\n* // returns true\n*\n* v = arr.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar val;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', value ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t} else {\n\t\t\tend = len;\n\t\t}\n\t} else {\n\t\tstart = 0;\n\t\tend = len;\n\t}\n\tif ( value ) {\n\t\tval = 1;\n\t} else {\n\t\tval = 0;\n\t}\n\tfor ( i = start; i < end; i++ ) {\n\t\tbuf[ i ] = val;\n\t}\n\treturn this;\n});\n\n/**\n* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.\n*\n* @name filter\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} boolean array\n*\n* @example\n* function predicate( v ) {\n* return ( v === true );\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 2\n*\n* var v = out.get( 0 );\n* // returns true\n*\n* v = out.get( 1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\tout.push( v );\n\t\t}\n\t}\n\treturn new this.constructor( out );\n});\n\n/**\n* Returns the first element in an array for which a predicate function returns a truthy value.\n*\n* @name find\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {(boolean|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.find( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn v;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the first element in an array for which a predicate function returns a truthy value.\n*\n* @name findIndex\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findIndex( predicate );\n* // returns 0\n*/\nsetReadOnly( BooleanArray.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLast\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {(boolean|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findLast( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn v;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLastIndex\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findLastIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Invokes a function once for each array element.\n*\n* @name forEach\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( BooleanArray.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tfcn.call( thisArg, Boolean( buf[ i ] ), i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(boolean|void)} array element\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* arr.set( [ true, false ], 0 );\n*\n* v = arr.get( 0 );\n* // returns true\n*\n* v = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( BooleanArray.prototype, 'get', function get( idx ) {\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isNonNegativeInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn Boolean( this._buffer[ idx ] );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a value\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( true, 3 );\n* arr.set( true, 4 );\n*\n* var bool = arr.includes( true );\n* // returns true\n*\n* bool = arr.includes( false, 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @name indexOf\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( true, 3 );\n* arr.set( true, 4 );\n*\n* var idx = arr.indexOf( true );\n* // returns 0\n*\n* idx = arr.indexOf( false, 2 );\n* // returns -1\n*\n* idx = arr.indexOf( false, -3 );\n* // returns -1\n*/\nsetReadOnly( BooleanArray.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new string by concatenating all array elements.\n*\n* @name join\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.join();\n* // returns 'true,false,true'\n*\n* str = arr.join( '|' );\n* // returns 'true|false|true'\n*/\nsetReadOnly( BooleanArray.prototype, 'join', function join( separator ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( arguments.length > 0 ) {\n\t\tif ( !isString( separator ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t\t}\n\t} else {\n\t\tseparator = ',';\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( buf[i] ) {\n\t\t\tout.push( 'true' );\n\t\t} else {\n\t\t\tout.push( 'false' );\n\t\t}\n\t}\n\treturn out.join( separator );\n});\n\n/**\n* Returns an iterator for iterating over each index key in a typed array.\n*\n* @name keys\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 2 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n*\n* var iter = arr.keys();\n*\n* var v = iter.next().value;\n* // returns 0\n*\n* v = iter.next().value;\n* // returns 1\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': i,\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.keys();\n\t}\n});\n\n/**\n* Returns the last index at which a given element can be found.\n*\n* @name lastIndexOf\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( true, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var idx = arr.lastIndexOf( true );\n* // returns 4\n*\n* idx = arr.lastIndexOf( false, 2 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( false, -3 );\n* // returns -1\n*/\nsetReadOnly( BooleanArray.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= this._length ) {\n\t\t\tfromIndex = this._length - 1;\n\t\t} else if ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t}\n\t} else {\n\t\tfromIndex = this._length - 1;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a new array with each element being the result of a provided callback function.\n*\n* @name map\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} new boolean array\n*\n* @example\n* function invert( v ) {\n* return !v;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.map( invert );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns false\n*\n* z = out.get( 1 );\n* // returns true\n*\n* z = out.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be a function. Value: `%s`.', fcn );\n\t}\n\tbuf = this._buffer;\n\tout = new this.constructor( this._length );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\toutbuf[ i ] = Boolean( fcn.call( thisArg, Boolean( buf[ i ] ), i, this ) );\n\t}\n\treturn out;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduce\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* function reducer( acc, v ) {\n* if ( v ) {\n* return acc + 1;\n* }\n* return acc;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.reduce( reducer, 0 );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = 0;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = Boolean( buf[ 0 ] );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tacc = reducer( acc, Boolean( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in reverse order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduceRight\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* function reducer( acc, v ) {\n* if ( v ) {\n* return acc + 1;\n* }\n* return acc;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.reduceRight( reducer, 0 );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = len - 1;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = Boolean( buf[ len-1 ] );\n\t\ti = len - 2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tacc = reducer( acc, Boolean( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} reversed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*\n* v = out.get( 1 );\n* // returns false\n*\n* v = out.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ i ];\n\t\tbuf[ i ] = buf[ j ];\n\t\tbuf[ j ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n*\n* In the other overlapping scenario,\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended.\n*\n* @name set\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {(Collection|BooleanArray|*)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n* @returns {void}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* arr.set( [ true, false ], 0 );\n*\n* v = arr.get( 0 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'set', function set( value ) {\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length > 1 ) {\n\t\tidx = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );\n\t\t}\n\t} else {\n\t\tidx = 0;\n\t}\n\tif ( isCollection( value ) ) {\n\t\tN = value.length;\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tif ( isBooleanArray( value ) ) {\n\t\t\tsbuf = value._buffer; // eslint-disable-line no-underscore-dangle\n\t\t} else {\n\t\t\tsbuf = value;\n\t\t}\n\t\t// Check for overlapping memory...\n\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\tif (\n\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t(\n\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t)\n\t\t) {\n\t\t\t// We need to copy source values...\n\t\t\ttmp = new Uint8Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\tbuf[ idx ] = ( sbuf[ i ] ) ? 1 : 0;\n\t\t}\n\t\treturn;\n\t}\n\tif ( idx >= this._length ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t}\n\tbuf[ idx ] = ( value ) ? 1 : 0;\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} [begin] - start index (inclusive)\n* @param {integer} [end] - end index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be integer\n* @throws {TypeError} second argument must be integer\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var bool = out.get( 0 );\n* // returns true\n*\n* bool = out.get( len-1 );\n* // returns true\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* bool = out.get( 0 );\n* // returns false\n*\n* bool = out.get( len-1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'slice', function slice( begin, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar len;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin < end ) {\n\t\toutlen = end - begin;\n\t} else {\n\t\toutlen = 0;\n\t}\n\tout = new this.constructor( outlen );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < outlen; i++ ) {\n\t\toutbuf[ i ] = buf[ i+begin ];\n\t}\n\treturn out;\n});\n\n/**\n* Tests whether at least one element in an array passes a test implemented by a predicate function.\n*\n* @name some\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether at least one element passes a test\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( false, 0 );\n* arr.set( true, 1 );\n* arr.set( false, 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Sorts an array in-place.\n*\n* @name sort\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a === false ) {\n* if ( b === false ) {\n* return 0;\n* }\n* return 1;\n* }\n* if ( b === true ) {\n* return 0;\n* }\n* return -1;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* arr.sort( compare );\n*\n* var v = arr.get( 0 );\n* // returns true\n*\n* v = arr.get( 1 );\n* // returns true\n*\n* v = arr.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'sort', function sort( compareFcn ) {\n\tvar buf;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length === 0 ) {\n\t\tbuf.sort();\n\t\treturn this;\n\t}\n\tif ( !isFunction( compareFcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', compareFcn ) );\n\t}\n\tbuf.sort( compare );\n\treturn this;\n\n\t/**\n\t* Comparison function for sorting.\n\t*\n\t* @private\n\t* @param {boolean} a - first boolean value for comparison\n\t* @param {boolean} b - second boolean value for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( Boolean( a ), Boolean( b ) );\n\t}\n});\n\n/**\n* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.\n*\n* @name subarray\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} [begin] - start index (inclusive)\n* @param {integer} [end] - end index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {BooleanArray} subarray\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var bool = subarr.get( 0 );\n* // returns true\n*\n* bool = subarr.get( len-1 );\n* // returns true\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* bool = subarr.get( 0 );\n* // returns false\n*\n* bool = subarr.get( len-1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin >= len ) {\n\t\tlen = 0;\n\t\toffset = buf.byteLength;\n\t} else if ( begin >= end ) {\n\t\tlen = 0;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t} else {\n\t\tlen = end - begin;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t}\n\treturn new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len );\n});\n\n/**\n* Serializes an array as a locale-specific string.\n*\n* @name toLocaleString\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {(string|Array)} [locales] - locale identifier(s)\n* @param {Object} [options] - configuration options\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a string or an array of strings\n* @throws {TypeError} options argument must be an object\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.toLocaleString();\n* // returns 'true,false,true'\n*/\nsetReadOnly( BooleanArray.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tloc = [];\n\t} else if ( isString( locales ) || isStringArray( locales ) ) {\n\t\tloc = locales;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string or an array of strings. Value: `%s`.', locales ) );\n\t}\n\tif ( arguments.length < 2 ) {\n\t\topts = {};\n\t} else if ( isObject( options ) ) {\n\t\topts = options;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( Boolean( buf[ i ] ).toLocaleString( loc, opts ) );\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} reversed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*\n* v = out.get( 1 );\n* // returns false\n*\n* v = out.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\toutbuf[ i ] = buf[ len - i - 1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Returns a new typed array containing the elements in sorted order.\n*\n* @name toSorted\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a === false ) {\n* if ( b === false ) {\n* return 0;\n* }\n* return 1;\n* }\n* if ( b === true ) {\n* return 0;\n* }\n* return -1;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.sort( compare );\n* // returns \n*\n* var v = out.get( 0 );\n* // returns true\n*\n* v = out.get( 1 );\n* // returns true\n*\n* v = out.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\toutbuf[ i ] = buf[ i ];\n\t}\n\tif ( arguments.length === 0 ) {\n\t\toutbuf.sort();\n\t\treturn out;\n\t}\n\tif ( !isFunction( compareFcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', compareFcn ) );\n\t}\n\toutbuf.sort( compare );\n\treturn out;\n\n\t/**\n\t* Comparison function for sorting.\n\t*\n\t* @private\n\t* @param {boolean} a - first boolean value for comparison\n\t* @param {boolean} b - second boolean value for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( Boolean( a ), Boolean( b ) );\n\t}\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.toString();\n* // returns 'true,false,true'\n*/\nsetReadOnly( BooleanArray.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( buf[i] ) {\n\t\t\tout.push( 'true' );\n\t\t} else {\n\t\t\tout.push( 'false' );\n\t\t}\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns an iterator for iterating over each value in a typed array.\n*\n* @name values\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 2 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns true\n*\n* v = iter.next().value;\n* // returns false\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'values', function values() {\n\tvar iter;\n\tvar self;\n\tvar len;\n\tvar FLG;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tbuf = this._buffer;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': Boolean( buf[ i ] ),\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.values();\n\t}\n});\n\n/**\n* Returns a new typed array with the element at a provided index replaced with a provided value.\n*\n* @name with\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {boolean} value - new value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {TypeError} second argument must be a boolean\n* @returns {BooleanArray} new typed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.with( 0, false );\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isInteger( index ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', index ) );\n\t}\n\tlen = this._length;\n\tif ( index < 0 ) {\n\t\tindex += len;\n\t}\n\tif ( index < 0 || index >= len ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%s`.', index ) );\n\t}\n\tif ( !isBoolean( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a boolean. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tif ( value ) {\n\t\tbuf[ index ] = 1;\n\t} else {\n\t\tbuf[ index ] = 0;\n\t}\n\treturn out;\n});\n\n\n// EXPORTS //\n\nmodule.exports = BooleanArray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Boolean array.\n*\n* @module @stdlib/array-bool\n*\n* @example\n* var BooleanArray = require( '@stdlib/array-bool' );\n*\n* var arr = new BooleanArray();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var BooleanArray = require( '@stdlib/array-bool' );\n*\n* var arr = new BooleanArray( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var BooleanArray = require( '@stdlib/array-bool' );\n*\n* var arr = new BooleanArray( [ true, false ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var BooleanArray = require( '@stdlib/array-bool' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 16\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var BooleanArray = require( '@stdlib/array-bool' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 8\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var BooleanArray = require( '@stdlib/array-bool' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new BooleanArray( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\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,EAAA,cAsBA,IAAIC,EAAU,QAAS,sBAAuB,EAY9C,SAAS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require_from_iterator", "__commonJSMin", "exports", "module", "Boolean", "fromIterator", "it", "out", "v", "require_from_iterator_map", "__commonJSMin", "exports", "module", "Boolean", "fromIteratorMap", "it", "clbk", "thisArg", "out", "v", "i", "require_from_array", "__commonJSMin", "exports", "module", "Boolean", "fromArray", "buf", "arr", "len", "require_main", "__commonJSMin", "exports", "module", "isNonNegativeInteger", "isCollection", "isArrayBuffer", "isObject", "isFunction", "isBoolean", "isInteger", "isString", "isStringArray", "hasIteratorSymbolSupport", "ITERATOR_SYMBOL", "setReadOnly", "setReadOnlyAccessor", "Uint8Array", "Boolean", "getter", "floor", "accessorGetter", "format", "fromIterator", "fromIteratorMap", "fromArray", "BYTES_PER_ELEMENT", "HAS_ITERATOR_SYMBOL", "isBooleanArray", "value", "isBooleanArrayConstructor", "BooleanArray", "byteOffset", "nargs", "buf", "len", "arg", "src", "thisArg", "clbk", "out", "tmp", "get", "i", "args", "idx", "target", "start", "self", "iter", "FLG", "next", "end", "factory", "predicate", "val", "v", "fcn", "searchElement", "fromIndex", "separator", "outbuf", "reducer", "initialValue", "acc", "N", "j", "sbuf", "begin", "outlen", "compareFcn", "compare", "a", "b", "offset", "locales", "options", "opts", "loc", "index", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 8bedabb..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,1266 +0,0 @@ - -{{alias}}() - A Boolean array. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > var arr = new {{alias}}() - - - -{{alias}}( length ) - Creates a boolean array having a specified length. - - Parameters - ---------- - length: integer - Typed array length. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > var arr = new {{alias}}( 10 ) - - > var len = arr.length - 10 - - -{{alias}}( booleanarray ) - Creates a boolean array from another boolean array. - - Parameters - ---------- - booleanarray: BooleanArray - Boolean array from which to generate another boolean array. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ true, false, false, true ] ) - - > var arr2 = new {{alias}}( arr1 ) - - > var len = arr2.length - 4 - - -{{alias}}( typedarray ) - Creates a boolean array from a typed array. - - Parameters - ---------- - typedarray: TypedArray - Typed array from which to generate boolean array. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/uint8}}( [ 1, 0, 0, 1 ] ) - - > var arr = new {{alias}}( buf ) - - > var len = arr.length - 4 - - -{{alias}}( obj ) - Creates a boolean array from an array-like object or iterable. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate a boolean array. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > var arr1 = new {{alias}}( [ true, false, false, true ] ) - - > var len = arr1.length - 4 - > var arr2 = new {{alias}}( [ {}, null, '', 4 ] ); - > len = arr2.length - 4 - - -{{alias}}( buffer[, byteOffset[, length]] ) - Returns a boolean array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first typed array - element. Default: 0. - - length: integer (optional) - View length. If not provided, the view spans from the byteOffset to - the end of the underlying ArrayBuffer. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 240 ); - > var arr1 = new {{alias}}( buf ) - - > var len = arr1.length - 240 - > var arr2 = new {{alias}}( buf, 8 ) - - > len = arr2.length - 232 - > var arr3 = new {{alias}}( buf, 8, 20 ) - - > len = arr3.length - 20 - - -{{alias}}.from( src[, clbk[, thisArg]] ) - Creates a new boolean array from an array-like object or an iterable. - - A callback function is provided two arguments: - - - value: source value. - - index: source index. - - Parameters - ---------- - src: ArrayLike|Iterable - Source of array elements. - - clbk: Function (optional) - Callback to invoke for each source element. - - thisArg: Any (optional) - Callback execution context. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > function map( v ) { return !v }; - > var src = [ true, false ]; - > var arr = {{alias}}.from( src, map ) - - > var len = arr.length - 2 - > var v = arr.get( 0 ) - false - > v = arr.get( 1 ) - true - - -{{alias}}.of( element0[, element1[, ...elementN]] ) - Creates a new boolean array from a variable number of arguments. - - Parameters - ---------- - element0: bool - Array element. - - element1: bool (optional) - Array element. - - elementN: ...bool (optional) - Array elements. - - Returns - ------- - out: BooleanArray - A typed array. - - Examples - -------- - > var arr = {{alias}}.of( true, false, false, true ) - - > var len = arr.length - 4 - - -{{alias}}.BYTES_PER_ELEMENT - The size of each array element in bytes. - - Examples - -------- - > var nbytes = {{alias}}.BYTES_PER_ELEMENT - 1 - - -{{alias}}.name - Typed array constructor name. - - Examples - -------- - > var str = {{alias}}.name - 'BooleanArray' - - -{{alias}}.prototype.buffer - Pointer to the underlying data buffer. - - Examples - -------- - > var arr = new {{alias}}( 2 ) - - > var buf = arr.buffer - - - -{{alias}}.prototype.byteLength - Size of the array in bytes. - - Examples - -------- - > var arr = new {{alias}}( 10 ) - - > var nbytes = arr.byteLength - 10 - - -{{alias}}.prototype.byteOffset - Offset (in bytes) of the array from the start of its underlying - ArrayBuffer. - - Examples - -------- - > var arr = new {{alias}}( 10 ) - - > var offset = arr.byteOffset - 0 - > var buf = new {{alias:@stdlib/array/buffer}}( 240 ); - > arr = new {{alias}}( buf, 64 ) - - > offset = arr.byteOffset - 64 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Size (in bytes) of each array element. - - Examples - -------- - > var arr = new {{alias}}( 10 ) - - > arr.BYTES_PER_ELEMENT - 1 - - -{{alias}}.prototype.length - The number of array elements. - - Examples - -------- - > var arr = new {{alias}}( 10 ) - - > var len = arr.length - 10 - - -{{alias}}.prototype.at( i ) - Returns an array element located at integer position (index) `i`, with - support for noth nonnegative and negative integer positions. - - If provided an index outside the array index range, the method returns - `undefined`. - - Parameters - ---------- - i: integer - Element index. - - Returns - ------- - out: boolean|void - An array element. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, false, true ] ) - - > var v = arr.at( 1 ) - false - > v = arr.at( -1 ) - true - - -{{alias}}.prototype.copyWithin( target, start[, end] ) - Copies a sequence of elements within the array starting at `start` and - ending at `end` (non-inclusive) to the position starting at `target`. - - Parameters - ---------- - target: integer - Target start index position. - - start: integer - Source start index position. - - end: integer (optional) - Source end index position. Default: out.length. - - Returns - ------- - out: BooleanArray - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, false, true ] ) - - > arr.copyWithin( 0, 2 ) - - > var v = arr.get( 0 ) - false - > v = arr.get( 1 ) - true - - -{{alias}}.prototype.entries() - Returns an iterator for iterating over array key-value pairs. - - Returns - ------- - iterator: Iterator - Iterator for iterating over array key-value pairs. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true ] ) - - > var it = arr.entries(); - > var v = it.next().value - [ 0, true ] - > v = it.next().value - [ 1, false ] - > v = it.next().value - [ 2, true ] - > var bool = it.next().done - true - - -{{alias}}.prototype.every( predicate[, thisArg] ) - Returns a boolean indicating whether all elements in the array pass a test. - - A predicate function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether all elements pass the test. - - Examples - -------- - > function predicate( v ) { return v === true; }; - > var arr = new {{alias}}( [ true, true, true ] ) - - > var bool = arr.every( predicate ) - true - - -{{alias}}.prototype.fill( value[, start[, end]] ) - Returns a modified typed array filled with a fill value. - - Parameters - ---------- - value: boolean - Fill value. - - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: BooleanArray - Modified array. - - Examples - -------- - > var arr = new {{alias}}( 3 ) - - > arr.fill( true ); - > var v = arr.get( 0 ) - true - > v = arr.get( 1 ) - true - > v = arr.get( 2 ) - true - - -{{alias}}.prototype.filter( predicate[, thisArg] ) - Returns a new array containing the elements of an array which pass a test - implemented by a predicate function. - - A predicate function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - The returned array has the same data type as the host array. - - Parameters - ---------- - predicate: Function - Predicate function which filters array elements. If a predicate function - returns a truthy value, an array element is included in the output - array; otherwise, an array element is not included in the output array. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - out: BooleanArray - A new typed array. - - Examples - -------- - > function predicate( v ) { return ( v === true ); }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var out = arr.filter( predicate ) - - > var len = out.length - 2 - > var v = out.get( 0 ) - true - > v = out.get( 1 ) - true - - -{{alias}}.prototype.find( predicate[, thisArg] ) - Returns the first element in an array for which a predicate function returns - a truthy value. - - A predicate function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - out: boolean|void - Array element or `undefined`. - - Examples - -------- - > function predicate( v ) { return v === true; }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var v = arr.find( predicate ) - true - - -{{alias}}.prototype.findIndex( predicate[, thisArg] ) - Returns the index of the first element in an array for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - out: integer - Array index or `-1`. - - Examples - -------- - > function predicate( v ) { return v === true; }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var idx = arr.findIndex( predicate ) - 0 - - -{{alias}}.prototype.findLast( predicate[, thisArg] ) - Returns the last element in an array for which a predicate function returns - a truthy value. - - A predicate function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - If a predicate function never returns a truthy value, the method returns - `undefined`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - out: boolean|void - Array element or `undefined`. - - Examples - -------- - > function predicate( v ) { return v === true; }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var v = arr.findLast( predicate ) - true - - -{{alias}}.prototype.findLastIndex( predicate[, thisArg] ) - Returns the index of the last element in an array for which a predicate - function returns a truthy value. - - A predicate function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - If a predicate function never returns a truthy value, the method returns - `-1`. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - out: integer - Array index or `-1`. - - Examples - -------- - > function predicate( v ) { return v === true; }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var idx = arr.findLastIndex( predicate ) - 2 - - -{{alias}}.prototype.forEach( clbk[, thisArg] ) - Invokes a function once for each array element. - - A callback function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - Parameters - ---------- - clbk: Function - Function to invoke for each array element. - - thisArg: Any (optional) - Execution context. - - Examples - -------- - > var str = '%'; - > function clbk( v ) { str += v.toString() + '%'; }; - > var arr = new {{alias}}( [ true, false, false, true ] ) - - > arr.forEach( clbk ); - > str - '%true%false%false%true%' - - -{{alias}}.prototype.get( i ) - Returns an array element located at integer position (index) `i`. - - If provided an index outside the array index range, the method returns - `undefined`. - - Parameters - ---------- - i: integer - Element index. - - Returns - ------- - out: boolean|void - Array element or `undefined`. - - Examples - -------- - > var arr = new {{alias}}( 10 ) - - > arr.set( true, 0 ); - > var v = arr.get( 0 ) - true - - -{{alias}}.prototype.includes( searchElement[, fromIndex] ) - Returns a boolean indicating whether an array includes a provided value. - - Parameters - ---------- - searchElement: boolean - Search element. - - fromIndex: integer (optional) - Array index at which to start the search. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether an array includes a search element. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true, true, true ] ) - - > var bool = arr.includes( true ) - true - > bool = arr.includes( false, 3 ) - false - - -{{alias}}.prototype.indexOf( searchElement[, fromIndex] ) - Returns the first index at which a given element can be found. - - If method does not find a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: boolean - Search element. - - fromIndex: integer (optional) - Array index at which to start the search. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: 0. - - Returns - ------- - out: integer - Array index or `-1`. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true, true, true ] ) - - > var idx = arr.indexOf( true ) - 0 - > idx = arr.indexOf( false, 3 ) - -1 - - -{{alias}}.prototype.join( [separator] ) - Returns a new string by concatenating all array elements separated by a - separator string. - - Parameters - ---------- - separator: string (optional) - Separator string. Default: ','. - - Returns - ------- - out: string - Array serialized as a string. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true ] ) - - > var str = arr.join() - 'true,false,true' - > str = arr.join( '|' ) - 'true|false|true' - - -{{alias}}.prototype.keys() - Returns an iterator for iterating over each index key in a typed array. - - Returns - ------- - iterator: Iterator - Iterator for iterating over array index keys. - - Examples - -------- - > var arr = new {{alias}}( [ true, false ] ) - - > var it = arr.keys(); - > var v = it.next().value - 0 - > v = it.next().value - 1 - > v = it.next().done - true - - -{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] ) - Returns the last index at which a given element can be found. - - If method does not find a search element, the method returns `-1`. - - Parameters - ---------- - searchElement: boolean - Search element. - - fromIndex: integer (optional) - Array index at which to start the search. If provided a negative value, - the method resolves the start index relative to the last array element. - Default: out.length-1. - - Returns - ------- - out: integer - Array index or `-1`. - - Examples - -------- - > var arr = new {{alias}}( [ true, true, true, false, true ] ) - - > var idx = arr.lastIndexOf( false ) - 3 - > idx = arr.lastIndexOf( false, 2 ) - -1 - - -{{alias}}.prototype.map( clbk[, thisArg] ) - Returns a new array with each element being the result of a provided - callback function. - - A callback function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - The returned array has the same data type as the host array. - - Parameters - ---------- - clbk: Function - Function which maps array elements to elements in the new array. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - out: BooleanArray - A new typed array. - - Examples - -------- - > function invert( v ) { return !v; }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var out = arr.map( invert ) - - > var v = out.get( 0 ) - false - > v = out.get( 1 ) - true - > v = out.get( 2 ) - false - - -{{alias}}.prototype.reduce( reducerFn[, initialValue] ) - Applies a provided function to each element of the array, in order, passing - in the return value from the calculation on the preceding element and - returning the accumulated result upon completion. - - A reducer function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the first array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the first array element as the first argument and the second array - element as the second argument. - - Parameters - ---------- - reducerFn: Function - Function to apply to each array element. - - initialValue: any (optional) - Initial accumulation value. - - Returns - ------- - out: any - Accumulated result. - - Examples - -------- - > function reducer( acc, v ) { return ( acc && v ); }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var out = arr.reduce( reducer ) - false - - -{{alias}}.prototype.reduceRight( reducerFn[, initialValue] ) - Applies a provided function to each element of the array, in reverse order, - passing in the return value from the calculation on the preceding element - and returning the accumulated result upon completion. - - A reducer function is provided the following arguments: - - - acc: accumulated result. - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - If provided an initial value, the method invokes a provided function with - the initial value as the first argument and the last array element as the - second argument. - - If not provided an initial value, the method invokes a provided function - with the last array element as the first argument and the second-to-last - array element as the second argument. - - Parameters - ---------- - reducerFn: Function - Function to apply to each array element. - - initialValue: any (optional) - Initial accumulation value. - - Returns - ------- - out: any - Accumulated result. - - Examples - -------- - > function reducer( acc, v ) { return ( acc && v ); }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var out = arr.reduceRight( reducer ) - false - - -{{alias}}.prototype.reverse() - Reverses the array *in-place*. - - This method mutates the array on which the method is invoked. - - Returns - ------- - out: BooleanArray - Modified array. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, false ] ) - - > arr.reverse(); - > var v = arr.get( 0 ) - false - > v = arr.get( 1 ) - false - > v = arr.get( 2 ) - true - - -{{alias}}.prototype.set( v[, i] ) - Sets one or more array elements. - - If provided a single argument, the method sets array elements starting at - position (index) `i = 0`. To set elements starting elsewhere in the array, - provide an index argument `i`. - - To set one or more array elements, provide an array-like object containing - truthy and falsy values. - - Parameters - ---------- - v: bool|BooleanArray|ArrayLikeObject - Boolean value or Boolean value array. - - i: integer (optional) - Array index at which to start setting elements. Default: 0. - - Examples - -------- - > var arr = new {{alias}}( 2 ) - - > arr.set( false ); - > var v = arr.get( 0 ) - false - > arr.set( true, 1 ); - > v = arr.get( 1 ) - true - - -{{alias}}.prototype.slice( [start[, end]] ) - Copies a portion of a typed array to a new typed array. - - Parameters - ---------- - start: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: BooleanArray - New typed array. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true, false, true ] ) - - > var out = arr.slice( 1 ) - - > var len = out.length - 4 - > var v = out.get( 0 ) - false - > v = out.get( 1 ) - true - - -{{alias}}.prototype.some( predicate[, thisArg] ) - Returns a boolean indicating whether at least one element passes a test. - - A predicate function is provided the following arguments: - - - value: current array element. - - index: current array element index. - - arr: the array on which the method was called. - - Parameters - ---------- - predicate: Function - Predicate function which tests array elements. If a predicate function - returns a truthy value, an array element passes; otherwise, an array - element fails. - - thisArg: Any (optional) - Execution context. - - Returns - ------- - bool: boolean - Boolean indicating whether at least one element passes the test. - - Examples - -------- - > function predicate( v ) { return v === true; }; - > var arr = new {{alias}}( [ false, true, false ] ) - - > var bool = arr.some( predicate ) - true - - -{{alias}}.prototype.sort( [compareFunction] ) - Sorts an array in-place. - - A comparison function determines the order of the array elements. The - function is provided two arguments: - - - a: first boolean value for comparison. - - b: second boolean value for comparison. - - The function should return a value less than zero if `a` comes before `b`, - a value greater than zero if `a` comes after `b`, and zero if `a` and `b` - are equivalent. - - Parameters - ---------- - compareFunction: Function (optional) - Comparison function. - - Returns - ------- - out: BooleanArray - Modified array. - - Examples - -------- - > function compare( a, b ) { return a === true ? -1 : 1; }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > arr.sort( compare ); - > var v = arr.get( 0 ) - true - > v = arr.get( 1 ) - true - > v = arr.get( 2 ) - false - - -{{alias}}.prototype.subarray( [begin[, end]] ) - Creates a new typed array view over the same underlying `ArrayBuffer` and - with the same underlying data type as the host array. - - Parameters - ---------- - begin: integer (optional) - Start index. If less than zero, the start index is resolved relative to - the last array element. Default: 0. - - end: integer (optional) - End index (non-inclusive). If less than zero, the end index is resolved - relative to the last array element. Default: out.length. - - Returns - ------- - out: BooleanArray - New typed array view. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true, false, true ] ) - - > var out = arr.subarray( 1, 3 ) - - > var len = out.length - 2 - > var v = out.get( 0 ) - false - > v = out.get( 1 ) - true - - -{{alias}}.prototype.toLocaleString( [locales[, options]] ) - Serializes an array as a locale-specific string. - - Parameters - ---------- - locales: string|Array (optional) - Locale identifier(s). - - options: Object (optional) - An object containing serialization options. - - Returns - ------- - str: string - Local-specific string. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true ] ) - - > var str = arr.toLocaleString() - 'true,false,true' - - -{{alias}}.prototype.toReversed() - Returns a new typed array containing the elements in reversed order. - - Returns - ------- - out: BooleanArray - New typed array. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, false ] ) - - > var out = arr.toReversed() - - > var v = out.get( 0 ) - false - > v = out.get( 1 ) - false - > v = out.get( 2 ) - true - - -{{alias}}.prototype.toSorted( [compareFunction] ) - Returns a new typed array containing the elements in sorted order. - - A comparison function determines the order of the array elements. The - function is provided two arguments: - - - a: first boolean value for comparison. - - b: second boolean value for comparison. - - The function should return a value less than zero if `a` comes before `b`, - a value greater than zero if `a` comes after `b`, and zero if `a` and `b` - are equivalent. - - Parameters - ---------- - compareFunction: Function (optional) - Comparison function. - - Returns - ------- - out: BooleanArray - New typed array. - - Examples - -------- - > function compare( a, b ) { return a === true ? -1 : 1; }; - > var arr = new {{alias}}( [ true, false, true ] ) - - > var out = arr.toSorted( compare ); - > var v = out.get( 0 ) - true - > v = out.get( 1 ) - true - > v = out.get( 2 ) - false - - -{{alias}}.prototype.toString() - Serializes an array as a string. - - Returns - ------- - out: string - String serialization of the array. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true ] ) - - > var str = arr.toString() - 'true,false,true' - - -{{alias}}.prototype.values() - Returns an iterator for iterating over each value in a typed array. - - Returns - ------- - iterator: Iterator - Iterator for iterating over array values. - - Examples - -------- - > var arr = new {{alias}}( [ true, false ] ) - - > var it = arr.values(); - > var v = it.next().value - true - > v = it.next().value - false - > var bool = it.next().done - true - - -{{alias}}.prototype.with( index, value ) - Returns a new typed array with the element at a provided index replaced with - a provided value. - - Parameters - ---------- - index: integer - Element index. - - value: boolean - Element value. - - Returns - ------- - out: BooleanArray - New typed array. - - Examples - -------- - > var arr = new {{alias}}( [ true, false, true ] ) - - > var out = arr.with( 0, false ) - - > var v = out.get( 0 ) - false - - - See Also - -------- diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 3acd0a2..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,1525 +0,0 @@ -/* eslint-disable max-lines */ - -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Iterator as Iter, IterableIterator, TypedIterator } from '@stdlib/types/iter'; -import { ArrayLike, BooleanArray as BooleanArrayInterface } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -// Define a union type representing both iterable and non-iterable iterators: -type Iterator = Iter | IterableIterator; - -/** -* Locale-specific configuration options. -*/ -interface LocaleOptions { - /** - * Configuration property. - */ - [ key: string | symbol | number ]: T | undefined; -} - -/** -* Callback invoked for each element in a source object. -* -* @returns transformed value -*/ -type FromNullary = ( this: U ) => boolean; - -/** -* Callback invoked for each element in a source object. -* -* @param value - source element -* @returns transformed value -*/ -type FromUnary = ( this: U, value: boolean ) => boolean; - -/** -* Callback invoked for each element in a source object. -* -* @param value - source element -* @param index - source element index -* @returns transformed value -*/ -type FromBinary = ( this: U, value: boolean, index: number ) => boolean; - -/** -* Callback invoked for each element in a source object. -* -* @param value - source element -* @param index - source element index -* @returns transformed value -*/ -type FromCallback = FromNullary | FromUnary | FromBinary; - -/** -* Checks whether an element in an array passes a test. -* -* @returns boolean indicating whether an element in an array passes a test -*/ -type NullaryPredicate = ( this: U ) => boolean; - -/** -* Checks whether an element in an array passes a test. -* -* @param value - current array element -* @returns boolean indicating whether an element in an array passes a test -*/ -type UnaryPredicate = ( this: U, value: boolean ) => boolean; - -/** -* Checks whether an element in an array passes a test. -* -* @param value - current array element -* @param index - current array element index -* @returns boolean indicating whether an element in an array passes a test -*/ -type BinaryPredicate = ( this: U, value: boolean, index: number ) => boolean; - -/** -* Checks whether an element in an array passes a test. -* -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns boolean indicating whether an element in an array passes a test -*/ -type TernaryPredicate = ( this: U, value: boolean, index: number, arr: BooleanArray ) => boolean; - -/** -* Checks whether an element in an array passes a test. -* -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns boolean indicating whether an element in an array passes a test -*/ -type Predicate = NullaryPredicate | UnaryPredicate | BinaryPredicate | TernaryPredicate; - -/** -* Callback invoked for each element in an array. -* -* @returns undefined -*/ -type NullaryCallback = ( this: U ) => void; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @returns undefined -*/ -type UnaryCallback = ( this: U, value: boolean ) => void; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @param index - current array element index -* @returns undefined -*/ -type BinaryCallback = ( this: U, value: boolean, index: number ) => void; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns undefined -*/ -type TernaryCallback = ( this: U, value: boolean, index: number, arr: BooleanArray ) => void; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns undefined -*/ -type Callback = NullaryCallback | UnaryCallback | BinaryCallback | TernaryCallback; - -/** -* Callback invoked for each element in an array. -* -* @returns returned value -*/ -type NullaryMapFcn = ( this: U ) => any; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @returns returned value -*/ -type UnaryMapFcn = ( this: U, value: boolean ) => any; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @param index - current array element index -* @returns returned value -*/ -type BinaryMapFcn = ( this: U, value: boolean, index: number ) => any; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns returned value -*/ -type TernaryMapFcn = ( this: U, value: boolean, index: number, arr: BooleanArray ) => any; - -/** -* Callback invoked for each element in an array. -* -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns returned value -*/ -type MapFcn = NullaryMapFcn | UnaryMapFcn | BinaryMapFcn | TernaryMapFcn; - -/** -* Reducer function invoked for each element in an array. -* -* @returns accumulated result -*/ -type NullaryReducer = () => U; - -/** -* Reducer function invoked for each element in an array. -* -* @param acc - accumulated result -* @returns accumulated result -*/ -type UnaryReducer = ( acc: U ) => U; - -/** -* Reducer function invoked for each element in an array. -* -* @param acc - accumulated result -* @param value - current array element -* @returns accumulated result -*/ -type BinaryReducer = ( acc: U, value: boolean ) => U; - -/** -* Reducer function invoked for each element in an array. -* -* @param acc - accumulated result -* @param value - current array element -* @param index - current array element index -* @returns accumulated result -*/ -type TernaryReducer = ( acc: U, value: boolean, index: number ) => U; - -/** -* @param acc - accumulated result -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns accumulated result -*/ -type QuaternaryReducer = ( acc: U, value: boolean, index: number, arr: BooleanArray ) => U; - -/** -* Reducer function invoked for each element in an array. -* -* @param acc - accumulated result -* @param value - current array element -* @param index - current array element index -* @param arr - array on which the method was called -* @returns accumulated result -*/ -type Reducer = NullaryReducer | UnaryReducer | BinaryReducer | TernaryReducer | QuaternaryReducer; - -/** -* Comparator function. -* -* @param a - first boolean value for comparison -* @param b - second boolean value for comparison -* @returns number indicating comparison result -*/ -type CompareFcn = ( a: boolean, b: boolean ) => number; - -/** -* Class for creating a Boolean array. -*/ -declare class BooleanArray implements BooleanArrayInterface { - /** - * Boolean array constructor. - * - * @param arg - length, typed array, array-like object, or buffer - * @param byteOffset - byte offset (default: 0) - * @param length - view length - * @throws if provided only a single argument, must provide a valid argument - * @throws byte offset must be a nonnegative integer - * @throws must provide sufficient memory to accommodate byte offset and view length requirements - * @returns boolean array - * - * @example - * var arr = new BooleanArray(); - * // returns - * - * var len = arr.length; - * // returns 0 - * - * @example - * var arr = new BooleanArray( 2 ); - * // returns - * - * var len = arr.length; - * // returns 2 - * - * @example - * var arr = new BooleanArray( [ true, false ] ); - * // returns - * - * var len = arr.length; - * // returns 2 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 16 ); - * var arr = new BooleanArray( buf ); - * // returns - * - * var len = arr.length; - * // returns 16 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 16 ); - * var arr = new BooleanArray( buf, 8 ); - * // returns - * - * var len = arr.length; - * // returns 8 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 32 ); - * var arr = new BooleanArray( buf, 8, 2 ); - * // returns - * - * var len = arr.length; - * // returns 2 - */ - constructor( arg?: number | ArrayLike | ArrayBuffer | Iterable, byteOffset?: number, length?: number ); - - /** - * Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer indices. - * - * @param i - element index - * @throws index argument must be an integer - * @returns array element - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var v = arr.at( 0 ); - * // returns true - * - * v = arr.at( -1 ); - * // returns true - * - * v = arr.at( 100 ); - * // returns undefined - */ - at( i: number ): boolean | void; - - /** - * Pointer to the underlying data buffer. - * - * @example - * var arr = new BooleanArray( 10 ); - * - * var buf = arr.buffer; - * // returns - */ - readonly buffer: ArrayBuffer; - - /** - * Length (in bytes) of the array. - * - * @example - * var arr = new BooleanArray( 10 ); - * - * var byteLength = arr.byteLength; - * // returns 10 - */ - readonly byteLength: number; - - /** - * Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`. - * - * @example - * var arr = new BooleanArray( 10 ); - * - * var byteOffset = arr.byteOffset; - * // returns 0 - */ - readonly byteOffset: number; - - /** - * Size (in bytes) of each array element. - * - * @example - * var arr = new BooleanArray( 10 ); - * - * var nbytes = arr.BYTES_PER_ELEMENT; - * // returns 1 - */ - readonly BYTES_PER_ELEMENT: 1; - - /** - * Number of array elements. - * - * @example - * var arr = new BooleanArray( 10 ); - * - * var len = arr.length; - * // returns 10 - */ - readonly length: number; - - /** - * Copies a sequence of elements within the array to the position starting at `target`. - * - * @param target - index at which to start copying elements - * @param start - source index at which to copy elements from - * @param end - source index at which to stop copying elements from - * @returns modified array - * - * @example - * var arr = new BooleanArray( 4 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( false, 2 ); - * arr.set( true, 3 ); - * - * // Copy the first two elements to the last two elements: - * arr.copyWithin( 2, 0, 2 ); - * - * var v = arr.get( 2 ); - * // returns true - * - * v = arr.get( 3 ); - * // returns false - */ - copyWithin( target: number, start: number, end?: number ): BooleanArray; - - /** - * Returns an iterator for iterating over array key-value pairs. - * - * @returns iterator - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var it = arr.entries(); - * - * var v = it.next().value; - * // returns [ 0, true ] - * - * v = it.next().value; - * // returns [ 1, false ] - * - * v = it.next().value; - * // returns [ 2, true ] - * - * var bool = it.next().done; - * // returns true - */ - entries(): TypedIterator<[number, boolean]>; - - /** - * Tests whether all elements in an array pass a test implemented by a predicate function. - * - * @param predicate - predicate function - * @param thisArg - predicate function execution context - * @returns boolean indicating whether all elements pass a test - * - * @example - * function predicate( v ) { - * return v === true; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( true, 1 ); - * arr.set( true, 2 ); - * - * var bool = arr.every( predicate ); - * // returns true - */ - every( predicate: Predicate, thisArg?: ThisParameterType> ): boolean; - - /** - * Returns a modified typed array filled with a fill value. - * - * @param value - fill value - * @param start - starting index (inclusive) - * @param end - ending index (exclusive) - * @returns modified typed array - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.fill( true, 1 ); - * - * var v = arr.get( 0 ); - * // returns false - * - * v = arr.get( 1 ); - * // returns true - * - * v = arr.get( 2 ); - * // returns true - */ - fill( value: boolean, start?: number, end?: number ): BooleanArray; - - /** - * Returns a new array containing the elements of an array which pass a test implemented by a predicate function. - * - * @param predicate - test function - * @param thisArg - execution context - * @returns new array containing elements which pass a test implemented by a predicate function - * - * @example - * function predicate( v ) { - * return ( v === true ); - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var out = arr.filter( predicate ); - * // returns - * - * var len = out.length; - * // returns 2 - * - * var v = out.get( 0 ); - * // returns true - * - * v = out.get( 1 ); - * // returns true - */ - filter( predicate: Predicate, thisArg?: ThisParameterType> ): BooleanArray; - - /** - * Returns the first element in an array for which a predicate function returns a truthy value. - * - * @param predicate - predicate function - * @param thisArg - predicate function execution context - * @returns array element or undefined - * - * @example - * function predicate( v ) { - * return v === true; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var v = arr.find( predicate ); - * // returns true - */ - find( predicate: Predicate, thisArg?: ThisParameterType> ): boolean | void; - - /** - * Returns the index of the first element in an array for which a predicate function returns a truthy value. - * - * @param predicate - predicate function - * @param thisArg - predicate function execution context - * @returns array index or -1 - * - * @example - * function predicate( v ) { - * return v === true; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var v = arr.findIndex( predicate ); - * // returns 0 - */ - findIndex( predicate: Predicate, thisArg?: ThisParameterType> ): number; - - /** - * Returns the last element in an array for which a predicate function returns a truthy value. - * - * @param predicate - predicate function - * @param thisArg - predicate function execution context - * @returns array element or undefined - * - * @example - * function predicate( v ) { - * return v === true; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var v = arr.findLast( predicate ); - * // returns true - */ - findLast( predicate: Predicate, thisArg?: ThisParameterType> ): boolean | void; - - /** - * Returns the index of the last element in an array for which a predicate function returns a truthy value. - * - * @param predicate - predicate function - * @param thisArg - predicate function execution context - * @returns array index or -1 - * - * @example - * function predicate( v ) { - * return v === true; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var v = arr.findLastIndex( predicate ); - * // returns 2 - */ - findLastIndex( predicate: Predicate, thisArg?: ThisParameterType> ): number; - - /** - * Invokes a function once for each array element. - * - * @param fcn - function to invoke - * @param thisArg - execution context - * @returns undefined - * - * @example - * function log( v, i ) { - * console.log( '%s: %s', i, v.toString() ); - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * arr.forEach( log ); - */ - forEach( fcn: Callback, thisArg?: ThisParameterType> ): void; - - /** - * Returns an array element. - * - * @param i - element index - * @throws index argument must be a nonnegative integer - * @returns array element - * - * @example - * var arr = new BooleanArray( 10 ); - * - * var v = arr.get( 0 ); - * // returns false - * - * arr.set( true, 0 ); - * - * v = arr.get( 100 ); - * // returns undefined - */ - get( i: number ): boolean | void; - - /** - * Returns a boolean indicating whether an array includes a provided value. - * - * @param searchElement - element to search for - * @param fromIndex - starting index (inclusive) - * @returns boolean indicating whether an array includes a value - * - * @example - * var arr = new BooleanArray( 5 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * arr.set( true, 3 ); - * arr.set( true, 4 ); - * - * var bool = arr.includes( true ); - * // returns true - * - * bool = arr.includes( false, 2 ); - * // returns false - */ - includes( searchElement: boolean, fromIndex?: number ): boolean; - - /** - * Returns the first index at which a given element can be found. - * - * @param searchElement - element to find - * @param fromIndex - starting index (inclusive) - * @returns index or -1 - * - * @example - * var arr = new BooleanArray( 5 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * arr.set( true, 3 ); - * arr.set( true, 4 ); - * - * var idx = arr.indexOf( true ); - * // returns 0 - * - * idx = arr.indexOf( false, 2 ); - * // returns -1 - * - * idx = arr.indexOf( false, -3 ); - * // returns -1 - */ - indexOf( searchElement: boolean, fromIndex?: number ): number; - - /** - * Returns a new string by concatenating all array elements. - * - * @param separator - value separator (default: ',') - * @returns string - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var str = arr.join(); - * // returns 'true,false,true' - * - * str = arr.join( '|' ); - * // returns 'true|false|true' - */ - join( separator?: string ): string; - - /** - * Returns an iterator for iterating over each index key in a typed array. - * - * @returns iterator - * - * @example - * var arr = new BooleanArray( 2 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * - * var iter = arr.keys(); - * - * var v = iter.next().value; - * // returns 0 - * - * v = iter.next().value; - * // returns 1 - * - * var bool = iter.next().done; - * // returns true - */ - keys(): TypedIterator; - - /** - * Returns the last index at which a given element can be found. - * - * @param searchElement - element to find - * @param fromIndex - index at which to start searching backward (inclusive) - * @returns index or -1 - * - * @example - * var arr = new BooleanArray( 5 ); - * - * arr.set( true, 0 ); - * arr.set( true, 1 ); - * arr.set( true, 2 ); - * arr.set( false, 3 ); - * arr.set( true, 4 ); - * - * var idx = arr.lastIndexOf( true ); - * // returns 4 - * - * idx = arr.lastIndexOf( false, 2 ); - * // returns -1 - * - * idx = arr.lastIndexOf( false, -3 ); - * // returns -1 - */ - lastIndexOf( searchElement: boolean, fromIndex?: number ): number; - - /** - * Returns a new array with each element being the result of a provided callback function. - * - * @param fcn - callback function - * @param thisArg - callback function execution context - * @returns new boolean array - * - * @example - * function invert( v ) { - * return !v; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var out = arr.map( invert ); - * // returns - * - * var v = out.get( 0 ); - * // returns false - * - * v = out.get( 1 ); - * // returns true - * - * v = out.get( 2 ); - * // returns false - */ - map( fcn: MapFcn, thisArg?: ThisParameterType> ): BooleanArray; - - /** - * Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion. - * - * @param reducer - callback function - * @param initialValue - initial value - * @returns accumulated result - * - * @example - * function reducer( acc, v ) { - * if ( v ) { - * return acc + 1; - * } - * return acc; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var out = arr.reduce( reducer, 0 ); - * // returns 2 - */ - reduce( reducer: Reducer, initialValue?: U ): U; - - /** - * Applies a provided callback function to each element of the array, in reverse order, passing in the return value from the calculation on the following element and returning the accumulated result upon completion. - * - * @param reducer - callback function - * @param initialValue - initial value - * @returns accumulated result - * - * @example - * function reducer( acc, v ) { - * if ( v ) { - * return acc + 1; - * } - * return acc; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var out = arr.reduceRight( reducer, 0 ); - * // returns 2 - */ - reduceRight( reducer: Reducer, initialValue?: U ): U; - - /** - * Reverses an array in-place. - * - * @returns reversed array - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( false, 2 ); - * - * var out = arr.reverse(); - * // returns - * - * var v = out.get( 0 ); - * // returns false - * - * v = out.get( 1 ); - * // returns false - * - * v = out.get( 2 ); - * // returns true - */ - reverse(): BooleanArray; - - /** - * Sets an array element. - * - * ## Notes - * - * - When provided a typed array, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario: - * - * ```text - * buf: --------------------- - * src: --------------------- - * ``` - * - * In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array. - * - * In the other overlapping scenario, - * - * ```text - * buf: --------------------- - * src: --------------------- - * ``` - * - * by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values as intended. - * - * - * @param value - value(s) - * @param i - element index at which to start writing values (default: 0) - * @throws index argument must be a nonnegative integer - * @throws index argument is out-of-bounds - * @throws target array lacks sufficient storage to accommodate source values - * - * @example - * var arr = new BooleanArray( 10 ); - * - * var v = arr.get( 0 ); - * // returns false - * - * arr.set( true, 0 ); - * - * v = arr.get( 0 ); - * // returns true - */ - set( value: ArrayLike | any, i?: number ): void; - - /** - * Copies a portion of a typed array to a new typed array. - * - * @param start - starting index (inclusive) - * @param end - ending index (exclusive) - * @throws indices must be integers - * @returns output array - * - * @example - * var arr = new BooleanArray( 5 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * arr.set( false, 3 ); - * arr.set( true, 4 ); - * - * var out = arr.slice(); - * // returns - * - * var len = out.length; - * // returns 5 - * - * var bool = out.get( 0 ); - * // returns true - * - * bool = out.get( len-1 ); - * // returns true - * - * out = arr.slice( 1, -2 ); - * // returns - * - * len = out.length; - * // returns 2 - * - * bool = out.get( 0 ); - * // returns false - * - * bool = out.get( len-1 ); - * // returns true - */ - slice( start?: number, end?: number ): BooleanArray; - - /** - * Tests whether at least one element in an array passes a test implemented by a predicate function. - * - * @param predicate - predicate function - * @param thisArg - predicate function execution context - * @returns boolean indicating whether at least one element passes a test - * - * @example - * function predicate( v ) { - * return v === true; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( false, 0 ); - * arr.set( true, 1 ); - * arr.set( false, 2 ); - * - * var bool = arr.some( predicate ); - * // returns true - */ - some( predicate: Predicate, thisArg?: ThisParameterType> ): boolean; - - /** - * Sorts an array in-place. - * - * @param compareFcn - comparison function - * @returns sorted array - * - * @example - * function compare( a, b ) { - * if ( a === false ) { - * if ( b === false ) { - * return 0; - * } - * return 1; - * } - * if ( b === true ) { - * return 0; - * } - * return -1; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * arr.sort( compare ); - * - * var v = arr.get( 0 ); - * // returns true - * - * v = arr.get( 1 ); - * // returns true - * - * v = arr.get( 2 ); - * // returns false - */ - sort( compareFcn: CompareFcn ): BooleanArray; - - /** - * Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array. - * - * @param begin - starting index (inclusive) - * @param end - ending index (exclusive) - * @throws indices must be integers - * @returns subarray - * - * @example - * var arr = new BooleanArray( 5 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * arr.set( false, 3 ); - * arr.set( true, 4 ); - * - * var subarr = arr.subarray(); - * // returns - * - * var len = subarr.length; - * // returns 5 - * - * var bool = subarr.get( 0 ); - * // returns true - * - * bool = subarr.get( len-1 ); - * // returns true - * - * subarr = arr.subarray( 1, -2 ); - * // returns - * - * len = subarr.length; - * // returns 2 - * - * bool = subarr.get( 0 ); - * // returns false - * - * bool = subarr.get( len-1 ); - * // returns true - */ - subarray( begin?: number, end?: number ): BooleanArray; - - /** - * Serializes an array as a locale-specific string. - * - * @param locales - locale identifier(s) - * @param options - configuration options - * @returns string - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var str = arr.toLocaleString(); - * // returns 'true,false,true' - */ - toLocaleString( locales?: string | Array, options?: LocaleOptions ): string; - - /** - * Returns a new typed array containing the elements in reversed order. - * - * @returns reversed array - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( false, 2 ); - * - * var out = arr.toReversed(); - * // returns - * - * var v = out.get( 0 ); - * // returns false - * - * v = out.get( 1 ); - * // returns false - * - * v = out.get( 2 ); - * // returns true - */ - toReversed(): BooleanArray; - - /** - * Returns a new typed array containing the elements in sorted order. - * - * @param compareFcn - comparison function - * @returns sorted array - * - * @example - * function compare( a, b ) { - * if ( a === false ) { - * if ( b === false ) { - * return 0; - * } - * return 1; - * } - * if ( b === true ) { - * return 0; - * } - * return -1; - * } - * - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var out = arr.toSorted( compare ); - * // returns - * - * var v = out.get( 0 ); - * // returns true - * - * v = out.get( 1 ); - * // returns true - * - * v = out.get( 2 ); - * // returns false - */ - toSorted( compareFcn: CompareFcn ): BooleanArray; - - /** - * Serializes an array as a string. - * - * @returns string - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var str = arr.toString(); - * // returns 'true,false,true' - */ - toString(): string; - - /** - * Returns an iterator for iterating over each value in a typed array. - * - * @returns iterator - * - * @example - * var arr = new BooleanArray( 2 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * - * var iter = arr.values(); - * - * var v = iter.next().value; - * // returns true - * - * v = iter.next().value; - * // returns false - * - * var bool = iter.next().done; - * // returns true - */ - values(): TypedIterator; - - /** - * Returns a new typed array with the element at a provided index replaced with a provided value. - * - * @param index - element index - * @param value - new value - * @throws first argument must be an integer - * @throws second argument must be a boolean - * @throws index argument is out-of-bounds - * @returns modified typed array - * - * @example - * var arr = new BooleanArray( 3 ); - * - * arr.set( true, 0 ); - * arr.set( false, 1 ); - * arr.set( true, 2 ); - * - * var out = arr.with( 0, false ); - * // returns - * - * var v = out.get( 0 ); - * // returns false - */ - with( index: number, value: boolean ): BooleanArray; -} - -/** -* Interface defining a Boolean array constructor which is both "newable" and "callable". -*/ -interface BooleanArrayConstructor { - /** - * Boolean array constructor. - * - * @param arg - length, typed array, array-like object, or buffer - * @param byteOffset - byte offset (default: 0) - * @param length - view length - * @throws if provided only a single argument, must provide a valid argument - * @throws byte offset must be a nonnegative integer - * @throws must provide sufficient memory to accommodate byte offset and view length requirements - * @returns boolean array - * - * @example - * var arr = new BooleanArray(); - * // returns - * - * var len = arr.length; - * // returns 0 - * - * @example - * var arr = new BooleanArray( 2 ); - * // returns - * - * var len = arr.length; - * // returns 2 - * - * @example - * var arr = new BooleanArray( [ true, false ] ); - * // returns - * - * var len = arr.length; - * // returns 2 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 16 ); - * var arr = new BooleanArray( buf ); - * // returns - * - * var len = arr.length; - * // returns 16 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 16 ); - * var arr = new BooleanArray( buf, 8 ); - * // returns - * - * var len = arr.length; - * // returns 8 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 32 ); - * var arr = new BooleanArray( buf, 8, 2 ); - * // returns - * - * var len = arr.length; - * // returns 2 - */ - new( arg?: number | ArrayLike | ArrayBuffer | Iterable, byteOffset?: number, length?: number ): BooleanArray; - - /** - * Boolean array constructor. - * - * @param arg - length, typed array, array-like object, or buffer - * @param byteOffset - byte offset (default: 0) - * @param length - view length - * @throws if provided only a single argument, must provide a valid argument - * @throws byte offset must be a nonnegative integer - * @throws must provide sufficient memory to accommodate byte offset and view length requirements - * @returns boolean array - * - * @example - * var arr = new BooleanArray(); - * // returns - * - * var len = arr.length; - * // returns 0 - * - * @example - * var arr = new BooleanArray( 2 ); - * // returns - * - * var len = arr.length; - * // returns 2 - * - * @example - * var arr = new BooleanArray( [ true, false ] ); - * // returns - * - * var len = arr.length; - * // returns 2 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 16 ); - * var arr = new BooleanArray( buf ); - * // returns - * - * var len = arr.length; - * // returns 16 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 16 ); - * var arr = new BooleanArray( buf, 8 ); - * // returns - * - * var len = arr.length; - * // returns 8 - * - * @example - * var ArrayBuffer = require( '@stdlib/array-buffer' ); - * - * var buf = new ArrayBuffer( 32 ); - * var arr = new BooleanArray( buf, 8, 2 ); - * // returns - * - * var len = arr.length; - * // returns 2 - */ - ( arg?: number | ArrayLike | ArrayBuffer | Iterable, byteOffset?: number, length?: number ): BooleanArray; - - /** - * Constructor name. - * - * @example - * var str = BooleanArray.name; - * // returns 'BooleanArray' - */ - readonly name: 'BooleanArray'; - - /** - * Size (in bytes) of each array element. - * - * @example - * var nbytes = BooleanArray.BYTES_PER_ELEMENT; - * // returns 1 - */ - readonly BYTES_PER_ELEMENT: 1; - - /** - * Creates a new boolean array from an array-like object or an iterable. - * - * @param src - array-like object or iterable - * @param clbk - callback to invoke for each source element - * @param thisArg - context - * @returns boolean array - * - * @example - * var arr = BooleanArray.from( [ true, false ] ); - * // returns - * - * var len = arr.length; - * // returns 2 - * - * @example - * function clbk( v ) { - * return !v; - * } - * - * var arr = BooleanArray.from( [ true, false ], clbk ); - * // returns - * - * var len = arr.length; - * // returns 2 - */ - from( src: ArrayLike | Iterable, clbk?: FromCallback, thisArg?: ThisParameterType> ): BooleanArray; - - /** - * Creates a new boolean array from a variable number of arguments. - * - * @param elements - array elements - * @returns boolean array - * - * @example - * var arr = BooleanArray.of( true, true, true, true ); - * // returns - * - * var len = arr.length; - * // returns 4 - */ - of( ...elements: Array ): BooleanArray; -} - -/** -* Boolean array constructor. -* -* @param arg - length, typed array, array-like object, or buffer -* @param byteOffset - byte offset (default: 0) -* @param length - view length -* @throws if provided only a single argument, must provide a valid argument -* @throws byte offset must be a nonnegative integer -* @throws must provide sufficient memory to accommodate byte offset and view length requirements -* @returns boolean array -* -* @example -* var arr = new BooleanArray(); -* // returns -* -* var len = arr.length; -* // returns 0 -* -* @example -* var arr = new BooleanArray( 2 ); -* // returns -* -* var len = arr.length; -* // returns 2 -* -* @example -* var arr = new BooleanArray( [ true, false ] ); -* // returns -* -* var len = arr.length; -* // returns 2 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 16 ); -* var arr = new BooleanArray( buf ); -* // returns -* -* var len = arr.length; -* // returns 16 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 16 ); -* var arr = new BooleanArray( buf, 8 ); -* // returns -* -* var len = arr.length; -* // returns 8 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = new BooleanArray( buf, 8, 2 ); -* // returns -* -* var len = arr.length; -* // returns 2 -*/ -declare var ctor: BooleanArrayConstructor; - - -// EXPORTS // - -export = ctor; - -// eslint-doctest-alias: BooleanArray diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index a05807a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import ArrayBuffer = require( '@stdlib/array-buffer' ); -import BooleanArray = require( './index' ); - -/** -* Callback function. -* -* @param v - value -* @returns input value -*/ -function clbk( v: boolean ): boolean { - return v; -} - - -// TESTS // - -// The function returns a boolean array... -{ - new BooleanArray(); // $ExpectType BooleanArray - BooleanArray(); // $ExpectType BooleanArray - new BooleanArray( 2 ); // $ExpectType BooleanArray - BooleanArray( 2 ); // $ExpectType BooleanArray - new BooleanArray( [ 1.0, -1.0 ] ); // $ExpectType BooleanArray - BooleanArray( [ 1.0, -1.0 ] ); // $ExpectType BooleanArray - - const buf = new ArrayBuffer( 16 ); - new BooleanArray( buf ); // $ExpectType BooleanArray - BooleanArray( buf ); // $ExpectType BooleanArray - new BooleanArray( buf, 8 ); // $ExpectType BooleanArray - BooleanArray( buf, 8 ); // $ExpectType BooleanArray - new BooleanArray( buf, 8, 2 ); // $ExpectType BooleanArray - BooleanArray( buf, 8, 2 ); // $ExpectType BooleanArray -} - -// The compiler throws an error if the function is provided a first argument that is not a number, typed array, array-like object, or array buffer... -{ - new BooleanArray( true ); // $ExpectError - new BooleanArray( false ); // $ExpectError - new BooleanArray( null ); // $ExpectError - new BooleanArray( {} ); // $ExpectError - new BooleanArray( ( x: boolean ): boolean => x ); // $ExpectError - - BooleanArray( true ); // $ExpectError - BooleanArray( false ); // $ExpectError - BooleanArray( null ); // $ExpectError - BooleanArray( {} ); // $ExpectError - BooleanArray( ( x: boolean ): boolean => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - const buf = new ArrayBuffer( 16 ); - new BooleanArray( buf, true ); // $ExpectError - new BooleanArray( buf, false ); // $ExpectError - new BooleanArray( buf, null ); // $ExpectError - new BooleanArray( buf, 'abc' ); // $ExpectError - new BooleanArray( buf, {} ); // $ExpectError - new BooleanArray( buf, ( x: boolean ): boolean => x ); // $ExpectError - - BooleanArray( buf, true ); // $ExpectError - BooleanArray( buf, false ); // $ExpectError - BooleanArray( buf, null ); // $ExpectError - BooleanArray( buf, 'abc' ); // $ExpectError - BooleanArray( buf, {} ); // $ExpectError - BooleanArray( buf, ( x: boolean ): boolean => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument that is not a number... -{ - const buf = new ArrayBuffer( 16 ); - new BooleanArray( buf, 8, true ); // $ExpectError - new BooleanArray( buf, 8, false ); // $ExpectError - new BooleanArray( buf, 8, null ); // $ExpectError - new BooleanArray( buf, 8, 'abc' ); // $ExpectError - new BooleanArray( buf, 8, {} ); // $ExpectError - new BooleanArray( buf, 8, ( x: boolean ): boolean => x ); // $ExpectError - - BooleanArray( buf, 8, true ); // $ExpectError - BooleanArray( buf, 8, false ); // $ExpectError - BooleanArray( buf, 8, null ); // $ExpectError - BooleanArray( buf, 8, 'abc' ); // $ExpectError - BooleanArray( buf, 8, {} ); // $ExpectError - BooleanArray( buf, 8, ( x: boolean ): boolean => x ); // $ExpectError -} - -// The `from` method returns a boolean array... -{ - BooleanArray.from( [ true, true ] ); // $ExpectType BooleanArray - BooleanArray.from( [ true, true ], ( x: boolean ): boolean => x ); // $ExpectType BooleanArray - BooleanArray.from( [ true ], clbk, {} ); // $ExpectType BooleanArray -} - -// The compiler throws an error if the `from` method is provided a first argument which is not array-like or iterable... -{ - BooleanArray.from( true ); // $ExpectError - BooleanArray.from( false ); // $ExpectError - BooleanArray.from( 123 ); // $ExpectError - BooleanArray.from( null ); // $ExpectError - BooleanArray.from( {} ); // $ExpectError - - BooleanArray.from( true, clbk ); // $ExpectError - BooleanArray.from( false, clbk ); // $ExpectError - BooleanArray.from( 123, clbk ); // $ExpectError - BooleanArray.from( null, clbk ); // $ExpectError - BooleanArray.from( {}, clbk ); // $ExpectError - - BooleanArray.from( true, clbk, {} ); // $ExpectError - BooleanArray.from( false, clbk, {} ); // $ExpectError - BooleanArray.from( 123, clbk, {} ); // $ExpectError - BooleanArray.from( null, clbk, {} ); // $ExpectError - BooleanArray.from( {}, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the `from` method is provided a second argument which is not a function with a supported signature... -{ - BooleanArray.from( [ true, true ], true ); // $ExpectError - BooleanArray.from( [ true, true ], false ); // $ExpectError - BooleanArray.from( [ true, true ], 123 ); // $ExpectError - BooleanArray.from( [ true, true ], null ); // $ExpectError - BooleanArray.from( [ true, true ], {} ); // $ExpectError -} - -// The `of` method returns a boolean array... -{ - BooleanArray.of( true, true, true, true ); // $ExpectType BooleanArray -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index d1b9dcf..0000000 --- a/examples/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Uint8Array = require( '@stdlib/array-uint8' ); -var logEach = require( '@stdlib/console-log-each' ); -var BooleanArray = require( './../lib' ); - -// Create a boolean array by specifying a length: -var out = new BooleanArray( 3 ); -logEach( '%s', out ); - -// Create a boolean array from an array of booleans: -var arr = [ true, false, true ]; -out = new BooleanArray( arr ); -logEach( '%s', out ); - -// Create a boolean array from an array buffer: -arr = new Uint8Array( [ 1, 0, 1, 1, 0, 1 ] ); -out = new BooleanArray( arr.buffer ); -logEach( '%s', out ); - -// Create a boolean array from an array buffer view: -arr = new Uint8Array( [ 1, 0, 1, 1, 0, 1 ] ); -out = new BooleanArray( arr.buffer, 1, 2 ); -logEach( '%s', out ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..49d0747 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(r="undefined"!=typeof globalThis?globalThis:r||self).BooleanArray=t()}(this,(function(){"use strict";var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var t=Object.defineProperty;function e(r){return"number"==typeof r}function n(r){var t,e="";for(t=0;t0&&(e-=1),n=r.toExponential(e)):n=r.toPrecision(t.precision),t.alternate||(n=h.call(n,b,"$1e"),n=h.call(n,v,"e"),n=h.call(n,g,""));break;default:throw new Error("invalid double notation. Value: "+t.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,p,"e-0$1"),t.alternate&&(n=h.call(n,y,"$1."),n=h.call(n,w,"$1.e")),r>=0&&t.sign&&(n=t.sign+n),n=t.specifier===s.call(t.specifier)?s.call(n):l.call(n)}function E(r){var t,e="";for(t=0;t127)throw new Error("invalid character code. Value: "+o.arg);o.arg=m(u)?String(o.arg):_(u)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(t||(o.precision=6),h=parseFloat(o.arg),!isFinite(h)){if(!e(o.arg))throw new Error("invalid floating-point number. Value: "+l);h=o.arg,o.padZeros=!1}o.arg=d(h,o);break;default:throw new Error("invalid specifier: "+o.specifier)}o.maxWidth>=0&&o.arg.length>o.maxWidth&&(o.arg=o.arg.substring(0,o.maxWidth)),o.padZeros?o.arg=i(o.arg,o.width||o.precision,o.padRight):o.width&&(o.arg=(y=o.arg,w=o.width,g=o.padRight,v=void 0,(v=w-y.length)<0?y:y=g?y+E(v):E(v)+y)),l+=o.arg||"",s+=1}return l}var x=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function A(r){var t={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(t.precision="1"),t}function O(r){var t,e,n,i;for(e=[],i=0,n=x.exec(r);n;)(t=r.slice(i,x.lastIndex-n[0].length)).length&&e.push(t),"%"===n[6]?e.push("%"):e.push(A(n)),i=x.lastIndex,n=x.exec(r);return(t=r.slice(i)).length&&e.push(t),e}function I(r){var t,e;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(t=[O(r)],e=1;err&&er(r)}function ir(r){return U(r)&&nr(r)}function or(r){return q(r)&&nr(r.valueOf())}function ar(r){return ir(r)||or(r)}function fr(r){return ir(r)&&r>=0}function ur(r){return or(r)&&r.valueOf()>=0}function lr(r){return fr(r)||ur(r)}C(ar,"isPrimitive",ir),C(ar,"isObject",or),C(lr,"isPrimitive",fr),C(lr,"isObject",ur);var sr=9007199254740991;function hr(r){return"object"==typeof r&&null!==r&&"number"==typeof r.length&&er(r.length)&&r.length>=0&&r.length<=sr}var cr="function"==typeof ArrayBuffer;function pr(r){return cr&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===z(r)}var yr=Array.isArray?Array.isArray:function(r){return"[object Array]"===z(r)};function wr(r){return"object"==typeof r&&null!==r&&!yr(r)}var gr=/./;function vr(r){return"boolean"==typeof r}var br=Boolean,dr=Boolean.prototype.toString;var Er=$();function _r(r){return"object"==typeof r&&(r instanceof br||(Er?function(r){try{return dr.call(r),!0}catch(r){return!1}}(r):"[object Boolean]"===z(r)))}function Tr(r){return vr(r)||_r(r)}C(Tr,"isPrimitive",vr),C(Tr,"isObject",_r);var mr="object"==typeof self?self:null,jr="object"==typeof window?window:null,Sr="object"==typeof global?global:null,xr="object"==typeof globalThis?globalThis:null;var Ar=function(r){if(arguments.length){if(!vr(r))throw new TypeError(I("invalid argument. Must provide a boolean. Value: `%s`.",r));if(r)return new Function("return this;")()}if(xr)return xr;if(mr)return mr;if(jr)return jr;if(Sr)return Sr;throw new Error("unexpected error. Unable to resolve global object.")}(),Or=Ar.document&&Ar.document.childNodes,Ir=Int8Array;function kr(){return/^\s*function\s*([^(]*)/i}var Lr=/^\s*function\s*([^(]*)/i;function Vr(r){if("function"!=typeof r)throw new TypeError(I("invalid argument. Must provide a function. Value: `%s`.",r));return function(t){var e,n;if(!yr(t))return!1;if(0===(e=t.length))return!1;for(n=0;ne.byteLength-r)throw new RangeError(rt("null2G",n*et));e=new qr(e,r,n)}}return C(this,"_buffer",e),C(this,"_length",e.length),this}return C(at,"BYTES_PER_ELEMENT",et),C(at,"name","BooleanArray"),C(at,"from",(function(r){var t,e,n,i,o,a,f,u,l;if(!Rr(this))throw new TypeError(rt("null01"));if(!ot(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if((e=arguments.length)>1){if(!Rr(n=arguments[1]))throw new TypeError(rt("null2H",n));e>2&&(t=arguments[2])}if(hr(r)){if(n){for(u=r.length,f=r.get&&r.set?function(r){var t=Qr[r];return"function"==typeof t?t:Qr.default}("default"):function(r){var t=Dr[r];return"function"==typeof t?t:Dr.default}("default"),o=(i=new this(u))._buffer,l=0;l=e))return br(t[r])})),zr(at.prototype,"buffer",(function(){return this._buffer.buffer})),zr(at.prototype,"byteLength",(function(){return this._buffer.byteLength})),zr(at.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(at.prototype,"BYTES_PER_ELEMENT",at.BYTES_PER_ELEMENT),C(at.prototype,"copyWithin",(function(r,t){if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return 2===arguments.length?this._buffer.copyWithin(r,t):this._buffer.copyWithin(r,t,arguments[2]),this})),C(at.prototype,"entries",(function(){var r,t,e,n,i,o;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return r=this,n=this._buffer,e=this._length,o=-1,C(t={},"next",(function(){if(o+=1,i||o>=e)return{done:!0};return{value:[o,br(n[o])],done:!1}})),C(t,"return",(function(r){if(i=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),Xr&&C(t,Xr,(function(){return r.entries()})),t})),C(at.prototype,"every",(function(r,t){var e,n;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Rr(r))throw new TypeError(rt("null3c",r));for(e=this._buffer,n=0;n1){if(!ir(t))throw new TypeError(rt("null7f",t));if(t<0&&(t+=i)<0&&(t=0),arguments.length>2){if(!ir(e))throw new TypeError(rt("null2z",e));e<0&&(e+=i)<0&&(e=0),e>i&&(e=i)}else e=i}else t=0,e=i;for(o=r?1:0,a=t;a=0;i--)if(n=br(e[i]),r.call(t,n,i,this))return n})),C(at.prototype,"findLastIndex",(function(r,t){var e,n,i;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Rr(r))throw new TypeError(rt("null3c",r));for(e=this._buffer,i=this._length-1;i>=0;i--)if(n=br(e[i]),r.call(t,n,i,this))return i;return-1})),C(at.prototype,"forEach",(function(r,t){var e,n;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Rr(r))throw new TypeError(rt("null3c",r));for(e=this._buffer,n=0;n=this._length))return br(this._buffer[r])})),C(at.prototype,"includes",(function(r,t){var e,n;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vr(r))throw new TypeError(rt("invalid argument. First argument must be a boolean. Value: `%s`.",r));if(arguments.length>1){if(!ir(t))throw new TypeError(rt("null7f",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(e=this._buffer,n=t;n1){if(!ir(t))throw new TypeError(rt("null7f",t));t<0&&(t+=this._length)<0&&(t=0)}else t=0;for(e=this._buffer,n=t;n0){if(!Nr(r))throw new TypeError(rt("null3F",r))}else r=",";for(t=this._buffer,e=[],n=0;n=e)return{done:!0};return{value:i,done:!1}})),C(t,"return",(function(r){if(n=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),Xr&&C(t,Xr,(function(){return r.keys()})),t})),C(at.prototype,"lastIndexOf",(function(r,t){var e,n;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!vr(r))throw new TypeError(rt("invalid argument. First argument must be a boolean. Value: `%s`.",r));if(arguments.length>1){if(!ir(t))throw new TypeError(rt("null7f",t));t>=this._length?t=this._length-1:t<0&&(t+=this._length)}else t=this._length-1;for(e=this._buffer,n=t;n>=0;n--)if(r===br(e[n]))return n;return-1})),zr(at.prototype,"length",(function(){return this._length})),C(at.prototype,"map",(function(r,t){var e,n,i,o;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Rr(r))throw new TypeError(rt("null3c"),r);for(i=this._buffer,e=(n=new this.constructor(this._length))._buffer,o=0;o1)i=t,o=0;else{if(0===n)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");i=br(e[0]),o=1}for(;o1)i=t,o=n-1;else{if(0===n)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");i=br(e[n-1]),o=n-2}for(;o>=0;o--)i=r(i,br(e[o]),o,this);return i})),C(at.prototype,"reverse",(function(){var r,t,e,n,i,o;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(r=this._buffer,e=this._length,n=tr(e/2),i=0;i1){if(!fr(e=arguments[1]))throw new TypeError(rt("null2L",e))}else e=0;if(hr(r)){if(e+(o=r.length)>this._length)throw new RangeError(rt("null03"));if(t=it(r)?r._buffer:r,f=n.byteOffset+e*et,t.buffer===n.buffer&&t.byteOffsetf){for(i=new qr(t.length),a=0;a=this._length)throw new RangeError(rt("null2M",e));n[e]=r?1:0}})),C(at.prototype,"slice",(function(r,t){var e,n,i,o,a,f;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(o=this._buffer,a=this._length,0===arguments.length)r=0,t=a;else{if(!ir(r))throw new TypeError(rt("null7e",r));if(r<0&&(r+=a)<0&&(r=0),1===arguments.length)t=a;else{if(!ir(t))throw new TypeError(rt("null7f",t));t<0?(t+=a)<0&&(t=0):t>a&&(t=a)}}for(e=ri&&(t=i)}}return r>=i?(i=0,e=n.byteLength):r>=t?(i=0,e=n.byteOffset+r*et):(i=t-r,e=n.byteOffset+r*et),new this.constructor(n.buffer,e,i<0?0:i)})),C(at.prototype,"toLocaleString",(function(r,t){var e,n,i,o,a;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(0===arguments.length)n=[];else{if(!Nr(r)&&!Gr(r))throw new TypeError(rt("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",r));n=r}if(arguments.length<2)e={};else{if(!wr(t))throw new TypeError(rt("null2V",t));e=t}for(o=this._buffer,i=[],a=0;a=e)return{done:!0};return{value:br(i[o]),done:!1}})),C(r,"return",(function(r){if(n=!0,arguments.length)return{value:r,done:!0};return{done:!0}})),Xr&&C(r,Xr,(function(){return t.values()})),r})),C(at.prototype,"with",(function(r,t){var e,n;if(!it(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!ir(r))throw new TypeError(rt("null7e",r));if(n=this._length,r<0&&(r+=n),r<0||r>=n)throw new RangeError(rt("nullFP",r));if(!vr(t))throw new TypeError(rt("null55",t));return(e=new this.constructor(this._buffer))._buffer[r]=t?1:0,e})),at})); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..e1afb20 --- /dev/null +++ b/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../node_modules/@stdlib/utils-define-property/lib/define_property.js","../node_modules/@stdlib/utils-define-property/lib/builtin.js","../node_modules/@stdlib/string-base-format-interpolate/lib/is_number.js","../node_modules/@stdlib/string-base-format-interpolate/lib/zero_pad.js","../node_modules/@stdlib/string-base-format-interpolate/lib/format_integer.js","../node_modules/@stdlib/string-base-format-interpolate/lib/format_double.js","../node_modules/@stdlib/string-base-format-interpolate/lib/space_pad.js","../node_modules/@stdlib/string-base-format-interpolate/lib/main.js","../node_modules/@stdlib/string-base-format-interpolate/lib/is_string.js","../node_modules/@stdlib/string-base-format-tokenize/lib/main.js","../node_modules/@stdlib/string-format/lib/main.js","../node_modules/@stdlib/string-format/lib/is_string.js","../node_modules/@stdlib/utils-define-property/lib/polyfill.js","../node_modules/@stdlib/utils-define-property/lib/index.js","../node_modules/@stdlib/utils-define-property/lib/has_define_property_support.js","../node_modules/@stdlib/utils-define-nonenumerable-read-only-property/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/primitive.js","../node_modules/@stdlib/assert-has-tostringtag-support/lib/main.js","../node_modules/@stdlib/assert-has-symbol-support/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostring.js","../node_modules/@stdlib/assert-has-own-property/lib/main.js","../node_modules/@stdlib/symbol-ctor/lib/main.js","../node_modules/@stdlib/utils-native-class/lib/tostringtag.js","../node_modules/@stdlib/utils-native-class/lib/index.js","../node_modules/@stdlib/utils-native-class/lib/polyfill.js","../node_modules/@stdlib/utils-native-class/lib/main.js","../node_modules/@stdlib/number-ctor/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/tostring.js","../node_modules/@stdlib/assert-is-number/lib/object.js","../node_modules/@stdlib/assert-is-number/lib/try2serialize.js","../node_modules/@stdlib/assert-is-number/lib/main.js","../node_modules/@stdlib/assert-is-number/lib/index.js","../node_modules/@stdlib/constants-float64-pinf/lib/index.js","../node_modules/@stdlib/constants-float64-ninf/lib/index.js","../node_modules/@stdlib/math-base-special-floor/lib/main.js","../node_modules/@stdlib/math-base-assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/integer.js","../node_modules/@stdlib/assert-is-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-integer/lib/object.js","../node_modules/@stdlib/assert-is-integer/lib/main.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/primitive.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/object.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/main.js","../node_modules/@stdlib/assert-is-integer/lib/index.js","../node_modules/@stdlib/assert-is-nonnegative-integer/lib/index.js","../node_modules/@stdlib/constants-array-max-typed-array-length/lib/index.js","../node_modules/@stdlib/assert-is-collection/lib/main.js","../node_modules/@stdlib/assert-is-arraybuffer/lib/main.js","../node_modules/@stdlib/assert-is-array/lib/main.js","../node_modules/@stdlib/assert-is-object/lib/main.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/re.js","../node_modules/@stdlib/assert-is-boolean/lib/primitive.js","../node_modules/@stdlib/boolean-ctor/lib/main.js","../node_modules/@stdlib/assert-is-boolean/lib/tostring.js","../node_modules/@stdlib/assert-is-boolean/lib/object.js","../node_modules/@stdlib/assert-is-boolean/lib/try2serialize.js","../node_modules/@stdlib/assert-is-boolean/lib/main.js","../node_modules/@stdlib/assert-is-boolean/lib/index.js","../node_modules/@stdlib/utils-global/lib/self.js","../node_modules/@stdlib/utils-global/lib/window.js","../node_modules/@stdlib/utils-global/lib/global.js","../node_modules/@stdlib/utils-global/lib/global_this.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/nodelist.js","../node_modules/@stdlib/utils-global/lib/main.js","../node_modules/@stdlib/utils-global/lib/codegen.js","../node_modules/@stdlib/utils-type-of/lib/fixtures/typedarray.js","../node_modules/@stdlib/regexp-function-name/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/regexp.js","../node_modules/@stdlib/assert-tools-array-function/lib/main.js","../node_modules/@stdlib/assert-is-object-like/lib/main.js","../node_modules/@stdlib/utils-constructor-name/lib/main.js","../node_modules/@stdlib/assert-is-buffer/lib/main.js","../node_modules/@stdlib/regexp-function-name/lib/index.js","../node_modules/@stdlib/assert-is-object-like/lib/index.js","../node_modules/@stdlib/utils-type-of/lib/index.js","../node_modules/@stdlib/utils-type-of/lib/check.js","../node_modules/@stdlib/utils-type-of/lib/polyfill.js","../node_modules/@stdlib/utils-type-of/lib/main.js","../node_modules/@stdlib/assert-is-function/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/primitive.js","../node_modules/@stdlib/assert-is-string/lib/valueof.js","../node_modules/@stdlib/assert-is-string/lib/object.js","../node_modules/@stdlib/assert-is-string/lib/try2valueof.js","../node_modules/@stdlib/assert-is-string/lib/main.js","../node_modules/@stdlib/assert-is-string/lib/index.js","../node_modules/@stdlib/assert-is-string-array/lib/index.js","../node_modules/@stdlib/assert-has-iterator-symbol-support/lib/main.js","../node_modules/@stdlib/symbol-iterator/lib/main.js","../node_modules/@stdlib/utils-define-nonenumerable-read-only-accessor/lib/main.js","../node_modules/@stdlib/assert-is-uint8array/lib/main.js","../node_modules/@stdlib/constants-uint8-max/lib/index.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/uint8array.js","../node_modules/@stdlib/array-uint8/lib/main.js","../node_modules/@stdlib/array-uint8/lib/index.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/main.js","../node_modules/@stdlib/array-uint8/lib/polyfill.js","../node_modules/@stdlib/array-base-getter/lib/main.js","../node_modules/@stdlib/array-base-accessor-getter/lib/main.js","../node_modules/@stdlib/error-tools-fmtprodmsg/lib/main.js","../lib/from_iterator.js","../lib/main.js","../lib/from_array.js","../lib/from_iterator_map.js"],"sourcesContent":["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 main = ( typeof Object.defineProperty === 'function' ) ? Object.defineProperty : null;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' ); // NOTE: we inline the `isNumber.isPrimitive` function from `@stdlib/assert/is-number` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// FUNCTIONS //\n\n/**\n* Tests if a string starts with a minus sign (`-`).\n*\n* @private\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string starts with a minus sign (`-`)\n*/\nfunction startsWithMinus( str ) {\n\treturn str[ 0 ] === '-';\n}\n\n/**\n* Returns a string of `n` zeros.\n*\n* @private\n* @param {number} n - number of zeros\n* @returns {string} string of zeros\n*/\nfunction zeros( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += '0';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with zeros to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction zeroPad( str, width, right ) {\n\tvar negative = false;\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tif ( startsWithMinus( str ) ) {\n\t\tnegative = true;\n\t\tstr = str.substr( 1 );\n\t}\n\tstr = ( right ) ?\n\t\tstr + zeros( pad ) :\n\t\tzeros( pad ) + str;\n\tif ( negative ) {\n\t\tstr = '-' + str;\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default zeroPad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isNumber from './is_number.js';\nimport zeroPad from './zero_pad.js';\n\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as an integer.\n*\n* @private\n* @param {Object} token - token object\n* @throws {Error} must provide a valid integer\n* @returns {string} formatted token argument\n*/\nfunction formatInteger( token ) {\n\tvar base;\n\tvar out;\n\tvar i;\n\n\tswitch ( token.specifier ) {\n\tcase 'b':\n\t\t// Case: %b (binary)\n\t\tbase = 2;\n\t\tbreak;\n\tcase 'o':\n\t\t// Case: %o (octal)\n\t\tbase = 8;\n\t\tbreak;\n\tcase 'x':\n\tcase 'X':\n\t\t// Case: %x, %X (hexadecimal)\n\t\tbase = 16;\n\t\tbreak;\n\tcase 'd':\n\tcase 'i':\n\tcase 'u':\n\tdefault:\n\t\t// Case: %d, %i, %u (decimal)\n\t\tbase = 10;\n\t\tbreak;\n\t}\n\tout = token.arg;\n\ti = parseInt( out, 10 );\n\tif ( !isFinite( i ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\tif ( !isNumber( out ) ) {\n\t\t\tthrow new Error( 'invalid integer. Value: ' + out );\n\t\t}\n\t\ti = 0;\n\t}\n\tif ( i < 0 && ( token.specifier === 'u' || base !== 10 ) ) {\n\t\ti = 0xffffffff + i + 1;\n\t}\n\tif ( i < 0 ) {\n\t\tout = ( -i ).toString( base );\n\t\tif ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tout = '-' + out;\n\t} else {\n\t\tout = i.toString( base );\n\t\tif ( !i && !token.precision ) {\n\t\t\tout = '';\n\t\t} else if ( token.precision ) {\n\t\t\tout = zeroPad( out, token.precision, token.padRight );\n\t\t}\n\t\tif ( token.sign ) {\n\t\t\tout = token.sign + out;\n\t\t}\n\t}\n\tif ( base === 16 ) {\n\t\tif ( token.alternate ) {\n\t\t\tout = '0x' + out;\n\t\t}\n\t\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\t\tuppercase.call( out ) :\n\t\t\tlowercase.call( out );\n\t}\n\tif ( base === 8 ) {\n\t\tif ( token.alternate && out.charAt( 0 ) !== '0' ) {\n\t\t\tout = '0' + out;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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\n// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies.\nvar abs = Math.abs; // eslint-disable-line stdlib/no-builtin-math\nvar lowercase = String.prototype.toLowerCase;\nvar uppercase = String.prototype.toUpperCase;\nvar replace = String.prototype.replace;\n\n\n// VARIABLES //\n\nvar RE_EXP_POS_DIGITS = /e\\+(\\d)$/;\nvar RE_EXP_NEG_DIGITS = /e-(\\d)$/;\nvar RE_ONLY_DIGITS = /^(\\d+)$/;\nvar RE_DIGITS_BEFORE_EXP = /^(\\d+)e/;\nvar RE_TRAILING_PERIOD_ZERO = /\\.0$/;\nvar RE_PERIOD_ZERO_EXP = /\\.0*e/;\nvar RE_ZERO_BEFORE_EXP = /(\\..*[^0])0*e/;\n\n\n// MAIN //\n\n/**\n* Formats a token object argument as a floating-point number.\n*\n* @private\n* @param {number} f - parsed number\n* @param {Object} token - token object\n* @throws {Error} must provide a valid floating-point number\n* @returns {string} formatted token argument\n*/\nfunction formatDouble( f, token ) {\n\tvar digits;\n\tvar out;\n\n\tswitch ( token.specifier ) {\n\tcase 'e':\n\tcase 'E':\n\t\tout = f.toExponential( token.precision );\n\t\tbreak;\n\tcase 'f':\n\tcase 'F':\n\t\tout = f.toFixed( token.precision );\n\t\tbreak;\n\tcase 'g':\n\tcase 'G':\n\t\tif ( abs( f ) < 0.0001 ) {\n\t\t\tdigits = token.precision;\n\t\t\tif ( digits > 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport isNumber from './is_number.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar f;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\tf = parseFloat( token.arg );\n\t\t\t\tif ( !isFinite( f ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies.\n\t\t\t\t\tif ( !isNumber( token.arg ) ) {\n\t\t\t\t\t\tthrow new Error( 'invalid floating-point number. Value: ' + out );\n\t\t\t\t\t}\n\t\t\t\t\t// Case: NaN, Infinity, or -Infinity\n\t\t\t\t\tf = token.arg;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( f, token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\t// Check for an escaped percent sign `%%`...\n\t\tif ( match[ 6 ] === '%' ) {\n\t\t\ttokens.push( '%' );\n\t\t} else {\n\t\t\ttokens.push( parse( match ) );\n\t\t}\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasSymbols from '@stdlib/assert-has-symbol-support';\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nexport default hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nexport default toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nexport default hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Sym = ( typeof Symbol === 'function' ) ? Symbol : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Sym;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nexport default toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Return a string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* import nativeClass from '@stdlib/utils-native-class';\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nimport hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasToStringTag() ) {\n\tmain = polyfill;\n} else {\n\tmain = builtin;\n}\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasOwnProp from '@stdlib/assert-has-own-property';\nimport toStringTag from './tostringtag.js';\nimport toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toStr from './tostring.js';\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nexport default nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// EXPORTS //\n\nexport default Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Number from '@stdlib/number-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* import isNumber from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNumber } from '@stdlib/assert-is-number';\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* import FLOAT64_PINF from '@stdlib/constants-float64-pinf';\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* import FLOAT64_NINF from '@stdlib/constants-float64-ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number-ctor';\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nexport default FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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';\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 PINF from '@stdlib/constants-float64-pinf';\nimport NINF from '@stdlib/constants-float64-ninf';\nimport isInt from '@stdlib/math-base-assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 as isNumber } from '@stdlib/assert-is-number';\nimport isInt from './integer.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 as isInteger } from '@stdlib/assert-is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* import isInteger from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* import { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* import { isObject as isInteger } from '@stdlib/assert-is-integer';\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* import isNonNegativeInteger from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* import MAX_TYPED_ARRAY_LENGTH from '@stdlib/constants-array-max-typed-array-length';\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nexport default MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-array-max-typed-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasArrayBuffer = ( typeof ArrayBuffer === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an ArrayBuffer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an ArrayBuffer\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var bool = isArrayBuffer( new ArrayBuffer( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isArrayBuffer( [] );\n* // returns false\n*/\nfunction isArrayBuffer( value ) {\n\treturn (\n\t\t( hasArrayBuffer && value instanceof ArrayBuffer ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object ArrayBuffer]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArrayBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nexport default f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isArray from '@stdlib/assert-is-array';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar RE = /./;\n\n\n// EXPORTS //\n\nexport default RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 boolean.\n*\n* @name Boolean\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {(boolean|Boolean)} boolean\n*\n* @example\n* var b = Boolean( null );\n* // returns false\n*\n* b = Boolean( [] );\n* // returns true\n*\n* b = Boolean( {} );\n* // returns true\n*\n* @example\n* var b = new Boolean( false );\n* // returns \n*/\nvar Bool = Boolean; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default Bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nexport default toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport Boolean from '@stdlib/boolean-ctor';\nimport test from './try2serialize.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n*\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import isBoolean from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* import Boolean from '@stdlib/boolean-ctor';\n* import { isObject as isBoolean } from '@stdlib/assert-is-boolean';\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 obj = ( typeof globalThis === 'object' ) ? globalThis : null; // eslint-disable-line no-undef\n\n\n// EXPORTS //\n\nexport default obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 getGlobal from '@stdlib/utils-global';\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nexport default nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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/string-format';\nimport getThis from './codegen.js';\nimport Self from './self.js';\nimport Win from './window.js';\nimport Global from './global.js';\nimport GlobalThis from './global_this.js';\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a boolean. Value: `%s`.', codegen ) );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: 2020 revision of ECMAScript standard\n\tif ( GlobalThis ) {\n\t\treturn GlobalThis;\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func, stdlib/require-globals\n}\n\n\n// EXPORTS //\n\nexport default getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nexport default reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 reFunctionName from './main.js';\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nexport default RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isArray from '@stdlib/assert-is-array';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* import isOdd from '@stdlib/assert-is-odd';\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', predicate ) );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\nimport { REGEXP as RE } from '@stdlib/regexp-function-name';\nimport isBuffer from '@stdlib/assert-is-buffer';\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nexport default constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isObjectLike from '@stdlib/assert-is-object-like';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* import reFunctionName from '@stdlib/regexp-function-name';\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* import isObjectLike from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* import { isObjectLikeArray as isObjectLike } from '@stdlib/assert-is-object-like';\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-function';\nimport main from './main.js';\n\n\n// VARIABLES //\n\nvar isObjectLikeArray = arrayfun( main );\n\n\n// MAIN //\n\nsetReadOnly( main, 'isObjectLikeArray', isObjectLikeArray );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* import typeOf from '@stdlib/utils-type-of';\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nimport usePolyfill from './check.js';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : builtin;\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 RE from './fixtures/re.js';\nimport nodeList from './fixtures/nodelist.js';\nimport typedarray from './fixtures/typedarray.js';\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 ctorName from '@stdlib/utils-constructor-name';\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 ctorName from '@stdlib/utils-constructor-name';\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nexport default typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 typeOf from '@stdlib/utils-type-of';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nexport default isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nexport default valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasToStringTag from '@stdlib/assert-has-tostringtag-support';\nimport nativeClass from '@stdlib/utils-native-class';\nimport test from './try2valueof.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 valueOf from './valueof.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* import isString from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* import { isObject as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* import { isPrimitive as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'isPrimitive', isPrimitive );\nsetReadOnly( main, 'isObject', isObject );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Test if a value is an array of strings.\n*\n* @module @stdlib/assert-is-string-array\n*\n* @example\n* import isStringArray from '@stdlib/assert-is-string-array';\n*\n* var bool = isStringArray( [ 'abc', 'def' ] );\n* // returns true\n*\n* bool = isStringArray( [ 'abc', 123 ] );\n* // returns false\n*\n* @example\n* import { primitives as isStringArray } from '@stdlib/assert-is-string-array';\n*\n* var bool = isStringArray( [ 'abc', 'def' ] );\n* // returns true\n*\n* bool = isStringArray( [ 'abc', new String( 'def' ) ] );\n* // returns false\n*\n* @example\n* import { objects as isStringArray } from '@stdlib/assert-is-string-array';\n*\n* var bool = isStringArray( [ new String( 'abc' ), new String( 'def' ) ] );\n* // returns true\n*\n* bool = isStringArray( [ new String( 'abc' ), 'def' ] );\n* // returns false\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport arrayfun from '@stdlib/assert-tools-array-function';\nimport isString from '@stdlib/assert-is-string';\n\n\n// VARIABLES //\n\nvar isPrimitiveArray = arrayfun( isString.isPrimitive );\nvar isObjectArray = arrayfun( isString.isObject );\n\n\n// MAIN //\n\nvar isStringArray = arrayfun( isString );\nsetReadOnly( isStringArray, 'primitives', isPrimitiveArray );\nsetReadOnly( isStringArray, 'objects', isObjectArray );\n\n\n// EXPORTS //\n\nexport default isStringArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasOwnProp from '@stdlib/assert-has-own-property';\nimport Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.iterator` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.iterator` support\n*\n* @example\n* var bool = hasIteratorSymbolSupport();\n* // returns \n*/\nfunction hasIteratorSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol' &&\n\t\thasOwnProp( Symbol, 'iterator' ) &&\n\t\ttypeof Symbol.iterator === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasIteratorSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\n\n\n// MAIN //\n\n/**\n* Iterator symbol.\n*\n* @name IteratorSymbol\n* @constant\n* @type {(symbol|null)}\n*\n* @example\n* function iterator() {\n* var it;\n* var i;\n*\n* i = -1;\n*\n* it = {};\n* it.next = next;\n* it.return = done;\n*\n* if ( IteratorSymbol ) {\n* it[ IteratorSymbol ] = iterator;\n* }\n* return it;\n*\n* function next() {\n* i += 1;\n* return {\n* 'value': i,\n* 'done': false\n* };\n* }\n*\n* function done( value ) {\n* if ( arguments.length === 0 ) {\n* return {\n* 'done': true\n* };\n* }\n* return {\n* 'value': value,\n* 'done': true\n* };\n* }\n* }\n*\n* var obj = iterator();\n*/\nvar IteratorSymbol = ( hasIteratorSymbolSupport() ) ? Symbol.iterator : null;\n\n\n// EXPORTS //\n\nexport default IteratorSymbol;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - accessor\n*\n* @example\n* function getter() {\n* return 'bar';\n* }\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnlyAccessor( obj, 'foo', getter );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnlyAccessor( obj, prop, getter ) { // eslint-disable-line id-length\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'get': getter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnlyAccessor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Maximum unsigned 8-bit integer.\n*\n* @module @stdlib/constants-uint8-max\n* @type {integer32}\n*\n* @example\n* import UINT8_MAX from '@stdlib/constants-uint8-max';\n* // returns 255\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 8-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{8} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 255\n*/\nvar UINT8_MAX = 255|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UINT8_MAX;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* import ctor from '@stdlib/array-uint8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ArraySupport from '@stdlib/assert-has-uint8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isUint8Array from '@stdlib/assert-is-uint8array';\nimport UINT8_MAX from '@stdlib/constants-uint8-max';\nimport GlobalUint8Array from './uint8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar GETTERS = {\n\t'float64': getFloat64,\n\t'float32': getFloat32,\n\t'int32': getInt32,\n\t'int16': getInt16,\n\t'int8': getInt8,\n\t'uint32': getUint32,\n\t'uint16': getUint16,\n\t'uint8': getUint8,\n\t'uint8c': getUint8c,\n\t'generic': getGeneric,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var arr = new Float64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat64( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat64( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float32Array from '@stdlib/array-float32';\n*\n* var arr = new Float32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat32( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat32( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int32Array from '@stdlib/array-int32';\n*\n* var arr = new Int32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt32( arr, 2 );\n* // returns 3\n*/\nfunction getInt32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int16Array from '@stdlib/array-int16';\n*\n* var arr = new Int16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt16( arr, 2 );\n* // returns 3\n*/\nfunction getInt16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int8Array from '@stdlib/array-int8';\n*\n* var arr = new Int8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt8( arr, 2 );\n* // returns 3\n*/\nfunction getInt8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint32Array from '@stdlib/array-uint32';\n*\n* var arr = new Uint32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint32( arr, 2 );\n* // returns 3\n*/\nfunction getUint32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint16Array from '@stdlib/array-uint16';\n*\n* var arr = new Uint16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint16( arr, 2 );\n* // returns 3\n*/\nfunction getUint16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var arr = new Uint8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8( arr, 2 );\n* // returns 3\n*/\nfunction getUint8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array-uint8c';\n*\n* var arr = new Uint8ClampedArray( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8c( arr, 2 );\n* // returns 3\n*/\nfunction getUint8c( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a generic `Array`.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getGeneric( arr, 2 );\n* // returns 3\n*/\nfunction getGeneric( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an indexed array-like object.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an indexed array-like object.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 2 );\n* // returns 3\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar GETTERS = {\n\t'complex128': getComplex128,\n\t'complex64': getComplex64,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex128( arr, 1 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction getComplex128( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex64( arr, 1 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction getComplex64( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from an array-like object supporting the get/set protocol.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* function get( idx ) {\n* return arr[ idx ];\n* }\n*\n* function set( value, idx ) {\n* arr[ idx ] = value;\n* }\n*\n* arr.get = get;\n* arr.set = set;\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an array-like object supporting the get/set protocol.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 1 );\n* // returns [ 3.0, 4.0 ]\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {Array} output array\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tout.push( Boolean( v.value ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\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 isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport { primitives as isStringArray } from '@stdlib/assert-is-string-array';\nimport hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\nimport ITERATOR_SYMBOL from '@stdlib/symbol-iterator';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport Uint8Array from '@stdlib/array-uint8';\nimport Boolean from '@stdlib/boolean-ctor';\nimport getter from '@stdlib/array-base-getter';\nimport floor from '@stdlib/math-base-special-floor';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\nimport fromArray from './from_array.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Uint8Array.BYTES_PER_ELEMENT;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a `BooleanArray`.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `BooleanArray`\n*/\nfunction isBooleanArray( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'BooleanArray' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a boolean typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean typed array constructor\n*/\nfunction isBooleanArrayConstructor( value ) {\n\treturn ( value === BooleanArray );\n}\n\n\n// MAIN //\n\n/**\n* Boolean array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {TypeError} if provided only a single argument, must provide a valid argument\n* @throws {TypeError} byte offset must be a nonnegative integer\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = new BooleanArray();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new BooleanArray( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new BooleanArray( [ true, false ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 16\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new BooleanArray( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 8\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new BooleanArray( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction BooleanArray() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\tvar arg;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof BooleanArray) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new BooleanArray();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new BooleanArray( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new BooleanArray( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new BooleanArray( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Uint8Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\targ = arguments[ 0 ];\n\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\tbuf = new Uint8Array( arg );\n\t\t} else if ( isCollection( arg ) ) {\n\t\t\tbuf = fromArray( new Uint8Array( arg.length ), arg );\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tbuf = new Uint8Array( arg );\n\t\t} else if ( isObject( arg ) ) {\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'null29', arg ) );\n\t\t\t}\n\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2A', arg ) );\n\t\t\t}\n\t\t\tbuf = arg[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2A', arg ) );\n\t\t\t}\n\t\t\tbuf = new Uint8Array( fromIterator( buf ) );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'null2A', arg ) );\n\t\t}\n\t} else {\n\t\tbuf = arguments[ 0 ];\n\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\tthrow new TypeError( format( 'null2B', buf ) );\n\t\t}\n\t\tbyteOffset = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'null2C', byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tbuf = new Uint8Array( buf, byteOffset );\n\t\t} else {\n\t\t\tlen = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2F', len ) );\n\t\t\t}\n\t\t\tif ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) {\n\t\t\t\tthrow new RangeError( format( 'null2G', len*BYTES_PER_ELEMENT ) );\n\t\t\t}\n\t\t\tbuf = new Uint8Array( buf, byteOffset, len );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof BooleanArray\n* @readonly\n* @type {PositiveInteger}\n* @default 1\n*\n* @example\n* var nbytes = BooleanArray.BYTES_PER_ELEMENT;\n* // returns 1\n*/\nsetReadOnly( BooleanArray, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof BooleanArray\n* @readonly\n* @type {string}\n* @default 'BooleanArray'\n*\n* @example\n* var str = BooleanArray.name;\n* // returns 'BooleanArray'\n*/\nsetReadOnly( BooleanArray, 'name', 'BooleanArray' );\n\n/**\n* Creates a new boolean array from an array-like object or an iterable.\n*\n* @name from\n* @memberof BooleanArray\n* @type {Function}\n* @param {(Collection|Iterable)} src - array-like object or iterable\n* @param {Function} [clbk] - callback to invoke for each source element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = BooleanArray.from( [ true, false ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* function clbk( v ) {\n* return !v;\n* }\n*\n* var arr = BooleanArray.from( [ true, false ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( BooleanArray, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\n\tvar get;\n\tvar len;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( format('null01') );\n\t}\n\tif ( !isBooleanArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'null2H', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\tlen = src.length;\n\t\t\tif ( src.get && src.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tbuf[ i ] = Boolean( clbk.call( thisArg, get( src, i ), i ) );\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( buf.next ) ) {\n\t\t\tthrow new TypeError( format( 'null2J', src ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIterator( buf );\n\t\t}\n\t\tlen = tmp.length;\n\t\tout = new this( len );\n\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tbuf[ i ] = tmp[ i ];\n\t\t}\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'null2J', src ) );\n});\n\n/**\n* Creates a new boolean array from a variable number of arguments.\n*\n* @name of\n* @memberof BooleanArray\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = BooleanArray.of( true, true, true, true );\n* // returns \n*\n* var len = arr.length;\n* // returns 4\n*/\nsetReadOnly( BooleanArray, 'of', function of() {\n\tvar args;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( format('null01') );\n\t}\n\tif ( !isBooleanArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\targs = [];\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn new this( args );\n});\n\n/**\n* Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} must provide an integer\n* @returns {(boolean|void)} array element\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.at( 0 );\n* // returns true\n*\n* v = arr.at( -1 );\n* // returns true\n*\n* v = arr.at( 100 );\n* // returns undefined\n*/\nsetReadOnly( BooleanArray.prototype, 'at', function at( idx ) {\n\tvar buf;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'null8A', idx ) );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tif ( idx < 0 ) {\n\t\tidx += len;\n\t}\n\tif ( idx < 0 || idx >= len ) {\n\t\treturn;\n\t}\n\treturn Boolean( buf[ idx ] );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'buffer', function get() {\n\treturn this._buffer.buffer;\n});\n\n/**\n* Size (in bytes) of the array.\n*\n* @name byteLength\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 10\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'byteLength', function get() {\n\treturn this._buffer.byteLength;\n});\n\n/**\n* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n*\n* @name byteOffset\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'byteOffset', function get() {\n\treturn this._buffer.byteOffset;\n});\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 1\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 1\n*/\nsetReadOnly( BooleanArray.prototype, 'BYTES_PER_ELEMENT', BooleanArray.BYTES_PER_ELEMENT );\n\n/**\n* Copies a sequence of elements within the array to the position starting at `target`.\n*\n* @name copyWithin\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} target - index at which to start copying elements\n* @param {integer} start - source index at which to copy elements from\n* @param {integer} [end] - source index at which to stop copying elements from\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} modified array\n*\n* @example\n* var arr = new BooleanArray( 4 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n* arr.set( true, 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* var v = arr.get( 2 );\n* // returns true\n*\n* v = arr.get( 3 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\t// FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled\n\tif ( arguments.length === 2 ) {\n\t\tthis._buffer.copyWithin( target, start );\n\t} else {\n\t\tthis._buffer.copyWithin( target, start, arguments[2] );\n\t}\n\treturn this;\n});\n\n/**\n* Returns an iterator for iterating over array key-value pairs.\n*\n* @name entries\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var it = arr.entries();\n*\n* var v = it.next().value;\n* // returns [ 0, true ]\n*\n* v = it.next().value;\n* // returns [ 1, false ]\n*\n* v = it.next().value;\n* // returns [ 2, true ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'entries', function entries() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar buf;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tbuf = this._buffer;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': [ i, Boolean( buf[ i ] ) ],\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.entries();\n\t}\n});\n\n/**\n* Tests whether all elements in an array pass a test implemented by a predicate function.\n*\n* @name every\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether all elements pass a test\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( true, 1 );\n* arr.set( true, 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( !predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n});\n\n/**\n* Returns a modified typed array filled with a fill value.\n*\n* @name fill\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} value - fill value\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {BooleanArray} modified array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.fill( true, 1 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* v = arr.get( 1 );\n* // returns true\n*\n* v = arr.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar val;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', value ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'null2z', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t} else {\n\t\t\tend = len;\n\t\t}\n\t} else {\n\t\tstart = 0;\n\t\tend = len;\n\t}\n\tif ( value ) {\n\t\tval = 1;\n\t} else {\n\t\tval = 0;\n\t}\n\tfor ( i = start; i < end; i++ ) {\n\t\tbuf[ i ] = val;\n\t}\n\treturn this;\n});\n\n/**\n* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.\n*\n* @name filter\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} boolean array\n*\n* @example\n* function predicate( v ) {\n* return ( v === true );\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 2\n*\n* var v = out.get( 0 );\n* // returns true\n*\n* v = out.get( 1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\tout.push( v );\n\t\t}\n\t}\n\treturn new this.constructor( out );\n});\n\n/**\n* Returns the first element in an array for which a predicate function returns a truthy value.\n*\n* @name find\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {(boolean|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.find( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn v;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the first element in an array for which a predicate function returns a truthy value.\n*\n* @name findIndex\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findIndex( predicate );\n* // returns 0\n*/\nsetReadOnly( BooleanArray.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLast\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {(boolean|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findLast( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn v;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLastIndex\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var v = arr.findLastIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tv = Boolean( buf[ i ] );\n\t\tif ( predicate.call( thisArg, v, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Invokes a function once for each array element.\n*\n* @name forEach\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( BooleanArray.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'null3c', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tfcn.call( thisArg, Boolean( buf[ i ] ), i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(boolean|void)} array element\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* arr.set( [ true, false ], 0 );\n*\n* v = arr.get( 0 );\n* // returns true\n*\n* v = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( BooleanArray.prototype, 'get', function get( idx ) {\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isNonNegativeInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'null2K', idx ) );\n\t}\n\tif ( idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn Boolean( this._buffer[ idx ] );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a value\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( true, 3 );\n* arr.set( true, 4 );\n*\n* var bool = arr.includes( true );\n* // returns true\n*\n* bool = arr.includes( false, 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @name indexOf\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( true, 3 );\n* arr.set( true, 4 );\n*\n* var idx = arr.indexOf( true );\n* // returns 0\n*\n* idx = arr.indexOf( false, 2 );\n* // returns -1\n*\n* idx = arr.indexOf( false, -3 );\n* // returns -1\n*/\nsetReadOnly( BooleanArray.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new string by concatenating all array elements.\n*\n* @name join\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.join();\n* // returns 'true,false,true'\n*\n* str = arr.join( '|' );\n* // returns 'true|false|true'\n*/\nsetReadOnly( BooleanArray.prototype, 'join', function join( separator ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( arguments.length > 0 ) {\n\t\tif ( !isString( separator ) ) {\n\t\t\tthrow new TypeError( format( 'null3F', separator ) );\n\t\t}\n\t} else {\n\t\tseparator = ',';\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( buf[i] ) {\n\t\t\tout.push( 'true' );\n\t\t} else {\n\t\t\tout.push( 'false' );\n\t\t}\n\t}\n\treturn out.join( separator );\n});\n\n/**\n* Returns an iterator for iterating over each index key in a typed array.\n*\n* @name keys\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 2 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n*\n* var iter = arr.keys();\n*\n* var v = iter.next().value;\n* // returns 0\n*\n* v = iter.next().value;\n* // returns 1\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': i,\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.keys();\n\t}\n});\n\n/**\n* Returns the last index at which a given element can be found.\n*\n* @name lastIndexOf\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {boolean} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (inclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a boolean value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( true, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var idx = arr.lastIndexOf( true );\n* // returns 4\n*\n* idx = arr.lastIndexOf( false, 2 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( false, -3 );\n* // returns -1\n*/\nsetReadOnly( BooleanArray.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isBoolean( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'null7f', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= this._length ) {\n\t\t\tfromIndex = this._length - 1;\n\t\t} else if ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t}\n\t} else {\n\t\tfromIndex = this._length - 1;\n\t}\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tif ( searchElement === Boolean( buf[ i ] ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof BooleanArray.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( BooleanArray.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a new array with each element being the result of a provided callback function.\n*\n* @name map\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} new boolean array\n*\n* @example\n* function invert( v ) {\n* return !v;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.map( invert );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns false\n*\n* z = out.get( 1 );\n* // returns true\n*\n* z = out.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format('null3c'), fcn );\n\t}\n\tbuf = this._buffer;\n\tout = new this.constructor( this._length );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\toutbuf[ i ] = Boolean( fcn.call( thisArg, Boolean( buf[ i ] ), i, this ) );\n\t}\n\treturn out;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduce\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* function reducer( acc, v ) {\n* if ( v ) {\n* return acc + 1;\n* }\n* return acc;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.reduce( reducer, 0 );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'null3c', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = 0;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = Boolean( buf[ 0 ] );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tacc = reducer( acc, Boolean( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in reverse order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduceRight\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* function reducer( acc, v ) {\n* if ( v ) {\n* return acc + 1;\n* }\n* return acc;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.reduceRight( reducer, 0 );\n* // returns 2\n*/\nsetReadOnly( BooleanArray.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'null3c', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = len - 1;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = Boolean( buf[ len-1 ] );\n\t\ti = len - 2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tacc = reducer( acc, Boolean( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} reversed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*\n* v = out.get( 1 );\n* // returns false\n*\n* v = out.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ i ];\n\t\tbuf[ i ] = buf[ j ];\n\t\tbuf[ j ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n*\n* In the other overlapping scenario,\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended.\n*\n* @name set\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {(Collection|BooleanArray|*)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n* @returns {void}\n*\n* @example\n* var arr = new BooleanArray( 10 );\n*\n* var v = arr.get( 0 );\n* // returns false\n*\n* arr.set( [ true, false ], 0 );\n*\n* v = arr.get( 0 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'set', function set( value ) {\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length > 1 ) {\n\t\tidx = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'null2L', idx ) );\n\t\t}\n\t} else {\n\t\tidx = 0;\n\t}\n\tif ( isCollection( value ) ) {\n\t\tN = value.length;\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( format('null03') );\n\t\t}\n\t\tif ( isBooleanArray( value ) ) {\n\t\t\tsbuf = value._buffer; // eslint-disable-line no-underscore-dangle\n\t\t} else {\n\t\t\tsbuf = value;\n\t\t}\n\t\t// Check for overlapping memory...\n\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\tif (\n\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t(\n\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t)\n\t\t) {\n\t\t\t// We need to copy source values...\n\t\t\ttmp = new Uint8Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\tbuf[ idx ] = ( sbuf[ i ] ) ? 1 : 0;\n\t\t}\n\t\treturn;\n\t}\n\tif ( idx >= this._length ) {\n\t\tthrow new RangeError( format( 'null2M', idx ) );\n\t}\n\tbuf[ idx ] = ( value ) ? 1 : 0;\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} [begin] - start index (inclusive)\n* @param {integer} [end] - end index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be integer\n* @throws {TypeError} second argument must be integer\n* @returns {BooleanArray} boolean array\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var bool = out.get( 0 );\n* // returns true\n*\n* bool = out.get( len-1 );\n* // returns true\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* bool = out.get( 0 );\n* // returns false\n*\n* bool = out.get( len-1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'slice', function slice( begin, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar len;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'null7e', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'null7f', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin < end ) {\n\t\toutlen = end - begin;\n\t} else {\n\t\toutlen = 0;\n\t}\n\tout = new this.constructor( outlen );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < outlen; i++ ) {\n\t\toutbuf[ i ] = buf[ i+begin ];\n\t}\n\treturn out;\n});\n\n/**\n* Tests whether at least one element in an array passes a test implemented by a predicate function.\n*\n* @name some\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether at least one element passes a test\n*\n* @example\n* function predicate( v ) {\n* return v === true;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( false, 0 );\n* arr.set( true, 1 );\n* arr.set( false, 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'null3c', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Sorts an array in-place.\n*\n* @name sort\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a === false ) {\n* if ( b === false ) {\n* return 0;\n* }\n* return 1;\n* }\n* if ( b === true ) {\n* return 0;\n* }\n* return -1;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* arr.sort( compare );\n*\n* var v = arr.get( 0 );\n* // returns true\n*\n* v = arr.get( 1 );\n* // returns true\n*\n* v = arr.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'sort', function sort( compareFcn ) {\n\tvar buf;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length === 0 ) {\n\t\tbuf.sort();\n\t\treturn this;\n\t}\n\tif ( !isFunction( compareFcn ) ) {\n\t\tthrow new TypeError( format( 'null3c', compareFcn ) );\n\t}\n\tbuf.sort( compare );\n\treturn this;\n\n\t/**\n\t* Comparison function for sorting.\n\t*\n\t* @private\n\t* @param {boolean} a - first boolean value for comparison\n\t* @param {boolean} b - second boolean value for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( Boolean( a ), Boolean( b ) );\n\t}\n});\n\n/**\n* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.\n*\n* @name subarray\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} [begin] - start index (inclusive)\n* @param {integer} [end] - end index (exclusive)\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {BooleanArray} subarray\n*\n* @example\n* var arr = new BooleanArray( 5 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n* arr.set( false, 3 );\n* arr.set( true, 4 );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var bool = subarr.get( 0 );\n* // returns true\n*\n* bool = subarr.get( len-1 );\n* // returns true\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* bool = subarr.get( 0 );\n* // returns false\n*\n* bool = subarr.get( len-1 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'null7e', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'null7f', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin >= len ) {\n\t\tlen = 0;\n\t\toffset = buf.byteLength;\n\t} else if ( begin >= end ) {\n\t\tlen = 0;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t} else {\n\t\tlen = end - begin;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t}\n\treturn new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len );\n});\n\n/**\n* Serializes an array as a locale-specific string.\n*\n* @name toLocaleString\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {(string|Array)} [locales] - locale identifier(s)\n* @param {Object} [options] - configuration options\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a string or an array of strings\n* @throws {TypeError} options argument must be an object\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.toLocaleString();\n* // returns 'true,false,true'\n*/\nsetReadOnly( BooleanArray.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tloc = [];\n\t} else if ( isString( locales ) || isStringArray( locales ) ) {\n\t\tloc = locales;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string or an array of strings. Value: `%s`.', locales ) );\n\t}\n\tif ( arguments.length < 2 ) {\n\t\topts = {};\n\t} else if ( isObject( options ) ) {\n\t\topts = options;\n\t} else {\n\t\tthrow new TypeError( format( 'null2V', options ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( Boolean( buf[ i ] ).toLocaleString( loc, opts ) );\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {BooleanArray} reversed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( false, 2 );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*\n* v = out.get( 1 );\n* // returns false\n*\n* v = out.get( 2 );\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\toutbuf[ i ] = buf[ len - i - 1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Returns a new typed array containing the elements in sorted order.\n*\n* @name toSorted\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be a function\n* @returns {BooleanArray} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a === false ) {\n* if ( b === false ) {\n* return 0;\n* }\n* return 1;\n* }\n* if ( b === true ) {\n* return 0;\n* }\n* return -1;\n* }\n*\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.sort( compare );\n* // returns \n*\n* var v = out.get( 0 );\n* // returns true\n*\n* v = out.get( 1 );\n* // returns true\n*\n* v = out.get( 2 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\toutbuf[ i ] = buf[ i ];\n\t}\n\tif ( arguments.length === 0 ) {\n\t\toutbuf.sort();\n\t\treturn out;\n\t}\n\tif ( !isFunction( compareFcn ) ) {\n\t\tthrow new TypeError( format( 'null3c', compareFcn ) );\n\t}\n\toutbuf.sort( compare );\n\treturn out;\n\n\t/**\n\t* Comparison function for sorting.\n\t*\n\t* @private\n\t* @param {boolean} a - first boolean value for comparison\n\t* @param {boolean} b - second boolean value for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( Boolean( a ), Boolean( b ) );\n\t}\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {string} string representation\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var str = arr.toString();\n* // returns 'true,false,true'\n*/\nsetReadOnly( BooleanArray.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( buf[i] ) {\n\t\t\tout.push( 'true' );\n\t\t} else {\n\t\t\tout.push( 'false' );\n\t\t}\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns an iterator for iterating over each value in a typed array.\n*\n* @name values\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a boolean array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new BooleanArray( 2 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns true\n*\n* v = iter.next().value;\n* // returns false\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( BooleanArray.prototype, 'values', function values() {\n\tvar iter;\n\tvar self;\n\tvar len;\n\tvar FLG;\n\tvar buf;\n\tvar i;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tself = this;\n\tbuf = this._buffer;\n\tlen = this._length;\n\n\t// Initialize an iteration index:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'value': Boolean( buf[ i ] ),\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.values();\n\t}\n});\n\n/**\n* Returns a new typed array with the element at a provided index replaced with a provided value.\n*\n* @name with\n* @memberof BooleanArray.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {boolean} value - new value\n* @throws {TypeError} `this` must be a boolean array\n* @throws {TypeError} first argument must be an integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {TypeError} second argument must be a boolean\n* @returns {BooleanArray} new typed array\n*\n* @example\n* var arr = new BooleanArray( 3 );\n*\n* arr.set( true, 0 );\n* arr.set( false, 1 );\n* arr.set( true, 2 );\n*\n* var out = arr.with( 0, false );\n* // returns \n*\n* var v = out.get( 0 );\n* // returns false\n*/\nsetReadOnly( BooleanArray.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\n\tif ( !isBooleanArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a boolean array.' );\n\t}\n\tif ( !isInteger( index ) ) {\n\t\tthrow new TypeError( format( 'null7e', index ) );\n\t}\n\tlen = this._length;\n\tif ( index < 0 ) {\n\t\tindex += len;\n\t}\n\tif ( index < 0 || index >= len ) {\n\t\tthrow new RangeError( format( 'nullFP', index ) );\n\t}\n\tif ( !isBoolean( value ) ) {\n\t\tthrow new TypeError( format( 'null55', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tif ( value ) {\n\t\tbuf[ index ] = 1;\n\t} else {\n\t\tbuf[ index ] = 0;\n\t}\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default BooleanArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Fills an output array with \"boolean\" values.\n*\n* @private\n* @param {Uint8Array} buf - output array\n* @param {Array} arr - input array\n* @returns {Uint8Array} output array\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar i;\n\n\tlen = arr.length;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tbuf[ i ] = Boolean( arr[ i ] );\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport Boolean from '@stdlib/boolean-ctor';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {Array} output array\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tout.push( Boolean( clbk.call( thisArg, v.value, i ) ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\n"],"names":["main","Object","defineProperty","isNumber","value","zeros","n","i","out","zeroPad","str","width","right","negative","pad","length","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","f","digits","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","parseFloat","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","push","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","defineProperty$1","setNonEnumerableReadOnly","configurable","enumerable","writable","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","nativeClass","hasToStringTag","v","isOwn","tag","main$3","Number","test","isPrimitive","isObject","setReadOnly","FLOAT64_PINF","POSITIVE_INFINITY","FLOAT64_NINF","NEGATIVE_INFINITY","floor","isInteger","x","PINF","NINF","isInt","valueOf","isNonNegativeInteger","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","hasArrayBuffer","ArrayBuffer","isArrayBuffer","main$2","isBoolean","Bool","Boolean","self","window","global","globalThis","root","codegen","Function","GlobalThis","Self","Win","Global","getGlobal","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","arrayfcn","predicate","len","isObjectLike","constructorName","name","ctor","constructor","_isBuffer","isBuffer","REGEXP","arrayfun","ctorName","type","isFunction","typeOf","isString","isPrimitiveArray","isObjectArray","isStringArray","hasIteratorSymbolSupport","iterator","IteratorSymbol","setNonEnumerableReadOnlyAccessor","getter","hasUint8Array","Uint8Array","Uint8Array$1","bool","arr","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","GETTERS","float64","idx","float32","int32","int16","int8","uint32","uint16","uint8","uint8c","generic","default","complex128","complex64","fmtprodmsg","a","u","encodeURIComponent","fromIterator","it","next","done","BYTES_PER_ELEMENT","HAS_ITERATOR_SYMBOL","isBooleanArray","isBooleanArrayConstructor","BooleanArray","byteOffset","nargs","buf","this","fromArray","ITERATOR_SYMBOL","byteLength","RangeError","src","thisArg","clbk","tmp","dtype","accessorGetter","_buffer","fromIteratorMap","_length","buffer","target","start","copyWithin","iter","entries","end","val","fcn","searchElement","fromIndex","separator","join","keys","outbuf","reducer","initialValue","acc","N","sbuf","begin","outlen","compareFcn","sort","b","offset","locales","options","opts","loc","toLocaleString","values","index"],"mappings":";6OAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCrF,IAAIA,EAAiBD,OAAOC,eCjB5B,SA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,EACA+K,EAEA,IAAAwD,GAAAM,MACA,MAAA,IAAA/K,UAAA,sDAEA,IAAA2E,GAAAkJ,GACA,MAAA,IAAA7N,UAAAiB,GAAA,SAAA4M,IAMA,GAJA5G,EAAA8D,KAAAa,QACAiC,EAAA,IACAA,GAAA5G,GAEA4G,EAAA,GAAAA,GAAA5G,EACA,MAAA,IAAAkE,WAAAlK,GAAA,SAAA4M,IAEA,IAAApI,GAAA3J,GACA,MAAA,IAAAkE,UAAAiB,GAAA,SAAAnF,IASA,OAPAI,EAAA,IAAA6O,KAAAzD,YAAAyD,KAAAW,UACAA,QAEAmC,GADA/R,EACA,EAEA,EAEAI,CACA","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98]} \ No newline at end of file diff --git a/lib/from_array.js b/lib/from_array.js deleted file mode 100644 index 350a5a3..0000000 --- a/lib/from_array.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Boolean = require( '@stdlib/boolean-ctor' ); - - -// MAIN // - -/** -* Fills an output array with "boolean" values. -* -* @private -* @param {Uint8Array} buf - output array -* @param {Array} arr - input array -* @returns {Uint8Array} output array -*/ -function fromArray( buf, arr ) { - var len; - var i; - - len = arr.length; - for ( i = 0; i < len; i++ ) { - buf[ i ] = Boolean( arr[ i ] ); - } - return buf; -} - - -// EXPORTS // - -module.exports = fromArray; diff --git a/lib/from_iterator.js b/lib/from_iterator.js deleted file mode 100644 index 1777c12..0000000 --- a/lib/from_iterator.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Boolean = require( '@stdlib/boolean-ctor' ); - - -// MAIN // - -/** -* Returns an array of iterated values. -* -* @private -* @param {Object} it - iterator -* @returns {Array} output array -*/ -function fromIterator( it ) { - var out; - var v; - - out = []; - while ( true ) { - v = it.next(); - if ( v.done ) { - break; - } - out.push( Boolean( v.value ) ); - } - return out; -} - - -// EXPORTS // - -module.exports = fromIterator; diff --git a/lib/from_iterator_map.js b/lib/from_iterator_map.js deleted file mode 100644 index 3f564d2..0000000 --- a/lib/from_iterator_map.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var Boolean = require( '@stdlib/boolean-ctor' ); - - -// MAIN // - -/** -* Returns an array of iterated values. -* -* @private -* @param {Object} it - iterator -* @param {Function} clbk - callback to invoke for each iterated value -* @param {*} thisArg - invocation context -* @returns {Array} output array -*/ -function fromIteratorMap( it, clbk, thisArg ) { - var out; - var v; - var i; - - out = []; - i = -1; - while ( true ) { - v = it.next(); - if ( v.done ) { - break; - } - i += 1; - out.push( Boolean( clbk.call( thisArg, v.value, i ) ) ); - } - return out; -} - - -// EXPORTS // - -module.exports = fromIteratorMap; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 0ded24d..0000000 --- a/lib/index.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Boolean array. -* -* @module @stdlib/array-bool -* -* @example -* var BooleanArray = require( '@stdlib/array-bool' ); -* -* var arr = new BooleanArray(); -* // returns -* -* var len = arr.length; -* // returns 0 -* -* @example -* var BooleanArray = require( '@stdlib/array-bool' ); -* -* var arr = new BooleanArray( 2 ); -* // returns -* -* var len = arr.length; -* // returns 2 -* -* @example -* var BooleanArray = require( '@stdlib/array-bool' ); -* -* var arr = new BooleanArray( [ true, false ] ); -* // returns -* -* var len = arr.length; -* // returns 2 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var BooleanArray = require( '@stdlib/array-bool' ); -* -* var buf = new ArrayBuffer( 16 ); -* var arr = new BooleanArray( buf ); -* // returns -* -* var len = arr.length; -* // returns 16 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var BooleanArray = require( '@stdlib/array-bool' ); -* -* var buf = new ArrayBuffer( 16 ); -* var arr = new BooleanArray( buf, 8 ); -* // returns -* -* var len = arr.length; -* // returns 8 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var BooleanArray = require( '@stdlib/array-bool' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = new BooleanArray( buf, 8, 2 ); -* // returns -* -* var len = arr.length; -* // returns 2 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 6448a45..0000000 --- a/lib/main.js +++ /dev/null @@ -1,2492 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-restricted-syntax, no-invalid-this */ - -'use strict'; - -// MODULES // - -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 isFunction = require( '@stdlib/assert-is-function' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var hasIteratorSymbolSupport = require( '@stdlib/assert-has-iterator-symbol-support' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var getter = require( '@stdlib/array-base-getter' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var accessorGetter = require( '@stdlib/array-base-accessor-getter' ); -var format = require( '@stdlib/string-format' ); -var fromIterator = require( './from_iterator.js' ); -var fromIteratorMap = require( './from_iterator_map.js' ); -var fromArray = require( './from_array.js' ); - - -// VARIABLES // - -var BYTES_PER_ELEMENT = Uint8Array.BYTES_PER_ELEMENT; -var HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport(); - - -// FUNCTIONS // - -/** -* Returns a boolean indicating if a value is a `BooleanArray`. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating if a value is a `BooleanArray` -*/ -function isBooleanArray( value ) { - return ( - typeof value === 'object' && - value !== null && - value.constructor.name === 'BooleanArray' && - value.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT - ); -} - -/** -* Returns a boolean indicating if a value is a boolean typed array constructor. -* -* @private -* @param {*} value - value to test -* @returns {boolean} boolean indicating if a value is a boolean typed array constructor -*/ -function isBooleanArrayConstructor( value ) { - return ( value === BooleanArray ); -} - - -// MAIN // - -/** -* Boolean array constructor. -* -* @constructor -* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @throws {TypeError} if provided only a single argument, must provide a valid argument -* @throws {TypeError} byte offset must be a nonnegative integer -* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements -* @returns {BooleanArray} boolean array -* -* @example -* var arr = new BooleanArray(); -* // returns -* -* var len = arr.length; -* // returns 0 -* -* @example -* var arr = new BooleanArray( 2 ); -* // returns -* -* var len = arr.length; -* // returns 2 -* -* @example -* var arr = new BooleanArray( [ true, false ] ); -* // returns -* -* var len = arr.length; -* // returns 2 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 16 ); -* var arr = new BooleanArray( buf ); -* // returns -* -* var len = arr.length; -* // returns 16 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 16 ); -* var arr = new BooleanArray( buf, 8 ); -* // returns -* -* var len = arr.length; -* // returns 8 -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = new BooleanArray( buf, 8, 2 ); -* // returns -* -* var len = arr.length; -* // returns 2 -*/ -function BooleanArray() { - var byteOffset; - var nargs; - var buf; - var len; - var arg; - - nargs = arguments.length; - if ( !(this instanceof BooleanArray) ) { - if ( nargs === 0 ) { - return new BooleanArray(); - } - if ( nargs === 1 ) { - return new BooleanArray( arguments[0] ); - } - if ( nargs === 2 ) { - return new BooleanArray( arguments[0], arguments[1] ); - } - return new BooleanArray( arguments[0], arguments[1], arguments[2] ); - } - // Create the underlying data buffer... - if ( nargs === 0 ) { - buf = new Uint8Array( 0 ); // backward-compatibility - } else if ( nargs === 1 ) { - arg = arguments[ 0 ]; - if ( isNonNegativeInteger( arg ) ) { - buf = new Uint8Array( arg ); - } else if ( isCollection( arg ) ) { - buf = fromArray( new Uint8Array( arg.length ), arg ); - } else if ( isArrayBuffer( arg ) ) { - buf = new Uint8Array( arg ); - } else if ( isObject( arg ) ) { - if ( HAS_ITERATOR_SYMBOL === false ) { - throw new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', arg ) ); - } - if ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) { - throw new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) ); - } - buf = arg[ ITERATOR_SYMBOL ](); - if ( !isFunction( buf.next ) ) { - throw new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) ); - } - buf = new Uint8Array( fromIterator( buf ) ); - } else { - throw new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) ); - } - } else { - buf = arguments[ 0 ]; - if ( !isArrayBuffer( buf ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) ); - } - byteOffset = arguments[ 1 ]; - if ( !isNonNegativeInteger( byteOffset ) ) { - throw new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) ); - } - if ( nargs === 2 ) { - buf = new Uint8Array( buf, byteOffset ); - } else { - len = arguments[ 2 ]; - if ( !isNonNegativeInteger( len ) ) { - throw new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) ); - } - if ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) { - throw new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len*BYTES_PER_ELEMENT ) ); - } - buf = new Uint8Array( buf, byteOffset, len ); - } - } - setReadOnly( this, '_buffer', buf ); - setReadOnly( this, '_length', buf.length ); - - return this; -} - -/** -* Size (in bytes) of each array element. -* -* @name BYTES_PER_ELEMENT -* @memberof BooleanArray -* @readonly -* @type {PositiveInteger} -* @default 1 -* -* @example -* var nbytes = BooleanArray.BYTES_PER_ELEMENT; -* // returns 1 -*/ -setReadOnly( BooleanArray, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT ); - -/** -* Constructor name. -* -* @name name -* @memberof BooleanArray -* @readonly -* @type {string} -* @default 'BooleanArray' -* -* @example -* var str = BooleanArray.name; -* // returns 'BooleanArray' -*/ -setReadOnly( BooleanArray, 'name', 'BooleanArray' ); - -/** -* Creates a new boolean array from an array-like object or an iterable. -* -* @name from -* @memberof BooleanArray -* @type {Function} -* @param {(Collection|Iterable)} src - array-like object or iterable -* @param {Function} [clbk] - callback to invoke for each source element -* @param {*} [thisArg] - context -* @throws {TypeError} `this` context must be a constructor -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be an array-like object or an iterable -* @throws {TypeError} second argument must be a function -* @returns {BooleanArray} boolean array -* -* @example -* var arr = BooleanArray.from( [ true, false ] ); -* // returns -* -* var len = arr.length; -* // returns 2 -* -* @example -* function clbk( v ) { -* return !v; -* } -* -* var arr = BooleanArray.from( [ true, false ], clbk ); -* // returns -* -* var len = arr.length; -* // returns 2 -*/ -setReadOnly( BooleanArray, 'from', function from( src ) { - var thisArg; - var nargs; - var clbk; - var out; - var buf; - var tmp; - var get; - var len; - var i; - if ( !isFunction( this ) ) { - throw new TypeError( 'invalid invocation. `this` context must be a constructor.' ); - } - if ( !isBooleanArrayConstructor( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - nargs = arguments.length; - if ( nargs > 1 ) { - clbk = arguments[ 1 ]; - if ( !isFunction( clbk ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) ); - } - if ( nargs > 2 ) { - thisArg = arguments[ 2 ]; - } - } - if ( isCollection( src ) ) { - if ( clbk ) { - len = src.length; - if ( src.get && src.set ) { - get = accessorGetter( 'default' ); - } else { - get = getter( 'default' ); - } - out = new this( len ); - buf = out._buffer; // eslint-disable-line no-underscore-dangle - for ( i = 0; i < len; i++ ) { - buf[ i ] = Boolean( clbk.call( thisArg, get( src, i ), i ) ); - } - return out; - } - return new this( src ); - } - if ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len - buf = src[ ITERATOR_SYMBOL ](); - if ( !isFunction( buf.next ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) ); - } - if ( clbk ) { - tmp = fromIteratorMap( buf, clbk, thisArg ); - } else { - tmp = fromIterator( buf ); - } - len = tmp.length; - out = new this( len ); - buf = out._buffer; // eslint-disable-line no-underscore-dangle - for ( i = 0; i < len; i++ ) { - buf[ i ] = tmp[ i ]; - } - return out; - } - throw new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) ); -}); - -/** -* Creates a new boolean array from a variable number of arguments. -* -* @name of -* @memberof BooleanArray -* @type {Function} -* @param {...*} element - array elements -* @throws {TypeError} `this` context must be a constructor -* @throws {TypeError} `this` must be a boolean array -* @returns {BooleanArray} boolean array -* -* @example -* var arr = BooleanArray.of( true, true, true, true ); -* // returns -* -* var len = arr.length; -* // returns 4 -*/ -setReadOnly( BooleanArray, 'of', function of() { - var args; - var i; - if ( !isFunction( this ) ) { - throw new TypeError( 'invalid invocation. `this` context must be a constructor.' ); - } - if ( !isBooleanArrayConstructor( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - args = []; - for ( i = 0; i < arguments.length; i++ ) { - args.push( arguments[ i ] ); - } - return new this( args ); -}); - -/** -* Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer indices. -* -* @name at -* @memberof BooleanArray.prototype -* @type {Function} -* @param {integer} idx - element index -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} must provide an integer -* @returns {(boolean|void)} array element -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var v = arr.at( 0 ); -* // returns true -* -* v = arr.at( -1 ); -* // returns true -* -* v = arr.at( 100 ); -* // returns undefined -*/ -setReadOnly( BooleanArray.prototype, 'at', function at( idx ) { - var buf; - var len; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isInteger( idx ) ) { - throw new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) ); - } - len = this._length; - buf = this._buffer; - if ( idx < 0 ) { - idx += len; - } - if ( idx < 0 || idx >= len ) { - return; - } - return Boolean( buf[ idx ] ); -}); - -/** -* Pointer to the underlying data buffer. -* -* @name buffer -* @memberof BooleanArray.prototype -* @readonly -* @type {ArrayBuffer} -* -* @example -* var arr = new BooleanArray( 10 ); -* -* var buf = arr.buffer; -* // returns -*/ -setReadOnlyAccessor( BooleanArray.prototype, 'buffer', function get() { - return this._buffer.buffer; -}); - -/** -* Size (in bytes) of the array. -* -* @name byteLength -* @memberof BooleanArray.prototype -* @readonly -* @type {NonNegativeInteger} -* -* @example -* var arr = new BooleanArray( 10 ); -* -* var byteLength = arr.byteLength; -* // returns 10 -*/ -setReadOnlyAccessor( BooleanArray.prototype, 'byteLength', function get() { - return this._buffer.byteLength; -}); - -/** -* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`. -* -* @name byteOffset -* @memberof BooleanArray.prototype -* @readonly -* @type {NonNegativeInteger} -* -* @example -* var arr = new BooleanArray( 10 ); -* -* var byteOffset = arr.byteOffset; -* // returns 0 -*/ -setReadOnlyAccessor( BooleanArray.prototype, 'byteOffset', function get() { - return this._buffer.byteOffset; -}); - -/** -* Size (in bytes) of each array element. -* -* @name BYTES_PER_ELEMENT -* @memberof BooleanArray.prototype -* @readonly -* @type {PositiveInteger} -* @default 1 -* -* @example -* var arr = new BooleanArray( 10 ); -* -* var nbytes = arr.BYTES_PER_ELEMENT; -* // returns 1 -*/ -setReadOnly( BooleanArray.prototype, 'BYTES_PER_ELEMENT', BooleanArray.BYTES_PER_ELEMENT ); - -/** -* Copies a sequence of elements within the array to the position starting at `target`. -* -* @name copyWithin -* @memberof BooleanArray.prototype -* @type {Function} -* @param {integer} target - index at which to start copying elements -* @param {integer} start - source index at which to copy elements from -* @param {integer} [end] - source index at which to stop copying elements from -* @throws {TypeError} `this` must be a boolean array -* @returns {BooleanArray} modified array -* -* @example -* var arr = new BooleanArray( 4 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( false, 2 ); -* arr.set( true, 3 ); -* -* // Copy the first two elements to the last two elements: -* arr.copyWithin( 2, 0, 2 ); -* -* var v = arr.get( 2 ); -* // returns true -* -* v = arr.get( 3 ); -* // returns false -*/ -setReadOnly( BooleanArray.prototype, 'copyWithin', function copyWithin( target, start ) { - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - // FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled - if ( arguments.length === 2 ) { - this._buffer.copyWithin( target, start ); - } else { - this._buffer.copyWithin( target, start, arguments[2] ); - } - return this; -}); - -/** -* Returns an iterator for iterating over array key-value pairs. -* -* @name entries -* @memberof BooleanArray.prototype -* @type {Function} -* @throws {TypeError} `this` must be a boolean array -* @returns {Iterator} iterator -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var it = arr.entries(); -* -* var v = it.next().value; -* // returns [ 0, true ] -* -* v = it.next().value; -* // returns [ 1, false ] -* -* v = it.next().value; -* // returns [ 2, true ] -* -* var bool = it.next().done; -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'entries', function entries() { - var self; - var iter; - var len; - var buf; - var FLG; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - self = this; - buf = this._buffer; - len = this._length; - - // Initialize an iteration index: - i = -1; - - // Create an iterator protocol-compliant object: - iter = {}; - setReadOnly( iter, 'next', next ); - setReadOnly( iter, 'return', end ); - - if ( ITERATOR_SYMBOL ) { - setReadOnly( iter, ITERATOR_SYMBOL, factory ); - } - return iter; - - /** - * Returns an iterator protocol-compliant object containing the next iterated value. - * - * @private - * @returns {Object} iterator protocol-compliant object - */ - function next() { - i += 1; - if ( FLG || i >= len ) { - return { - 'done': true - }; - } - return { - 'value': [ i, Boolean( buf[ i ] ) ], - 'done': false - }; - } - - /** - * Finishes an iterator. - * - * @private - * @param {*} [value] - value to return - * @returns {Object} iterator protocol-compliant object - */ - function end( value ) { - FLG = true; - if ( arguments.length ) { - return { - 'value': value, - 'done': true - }; - } - return { - 'done': true - }; - } - - /** - * Returns a new iterator. - * - * @private - * @returns {Iterator} iterator - */ - function factory() { - return self.entries(); - } -}); - -/** -* Tests whether all elements in an array pass a test implemented by a predicate function. -* -* @name every -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} predicate - predicate function -* @param {*} [thisArg] - predicate function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {boolean} boolean indicating whether all elements pass a test -* -* @example -* function predicate( v ) { -* return v === true; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( true, 1 ); -* arr.set( true, 2 ); -* -* var bool = arr.every( predicate ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'every', function every( predicate, thisArg ) { - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); - } - buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - if ( !predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) { - return false; - } - } - return true; -}); - -/** -* Returns a modified typed array filled with a fill value. -* -* @name fill -* @memberof BooleanArray.prototype -* @type {Function} -* @param {boolean} value - fill value -* @param {integer} [start=0] - starting index (inclusive) -* @param {integer} [end] - ending index (exclusive) -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a boolean -* @throws {TypeError} second argument must be an integer -* @throws {TypeError} third argument must be an integer -* @returns {BooleanArray} modified array -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.fill( true, 1 ); -* -* var v = arr.get( 0 ); -* // returns false -* -* v = arr.get( 1 ); -* // returns true -* -* v = arr.get( 2 ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'fill', function fill( value, start, end ) { - var buf; - var len; - var val; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isBoolean( value ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', value ) ); - } - buf = this._buffer; - len = this._length; - if ( arguments.length > 1 ) { - if ( !isInteger( start ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', start ) ); - } - if ( start < 0 ) { - start += len; - if ( start < 0 ) { - start = 0; - } - } - if ( arguments.length > 2 ) { - if ( !isInteger( end ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', end ) ); - } - if ( end < 0 ) { - end += len; - if ( end < 0 ) { - end = 0; - } - } - if ( end > len ) { - end = len; - } - } else { - end = len; - } - } else { - start = 0; - end = len; - } - if ( value ) { - val = 1; - } else { - val = 0; - } - for ( i = start; i < end; i++ ) { - buf[ i ] = val; - } - return this; -}); - -/** -* Returns a new array containing the elements of an array which pass a test implemented by a predicate function. -* -* @name filter -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} predicate - test function -* @param {*} [thisArg] - predicate function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {BooleanArray} boolean array -* -* @example -* function predicate( v ) { -* return ( v === true ); -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var out = arr.filter( predicate ); -* // returns -* -* var len = out.length; -* // returns 2 -* -* var v = out.get( 0 ); -* // returns true -* -* v = out.get( 1 ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'filter', function filter( predicate, thisArg ) { - var buf; - var out; - var i; - var v; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); - } - buf = this._buffer; - out = []; - for ( i = 0; i < this._length; i++ ) { - v = Boolean( buf[ i ] ); - if ( predicate.call( thisArg, v, i, this ) ) { - out.push( v ); - } - } - return new this.constructor( out ); -}); - -/** -* Returns the first element in an array for which a predicate function returns a truthy value. -* -* @name find -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} predicate - predicate function -* @param {*} [thisArg] - predicate function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {(boolean|void)} array element or undefined -* -* @example -* function predicate( v ) { -* return v === true; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var v = arr.find( predicate ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'find', function find( predicate, thisArg ) { - var buf; - var v; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); - } - buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - v = Boolean( buf[ i ] ); - if ( predicate.call( thisArg, v, i, this ) ) { - return v; - } - } -}); - -/** -* Returns the index of the first element in an array for which a predicate function returns a truthy value. -* -* @name findIndex -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} predicate - predicate function -* @param {*} [thisArg] - predicate function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {integer} index or -1 -* -* @example -* function predicate( v ) { -* return v === true; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var v = arr.findIndex( predicate ); -* // returns 0 -*/ -setReadOnly( BooleanArray.prototype, 'findIndex', function findIndex( predicate, thisArg ) { - var buf; - var v; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); - } - buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - v = Boolean( buf[ i ] ); - if ( predicate.call( thisArg, v, i, this ) ) { - return i; - } - } - return -1; -}); - -/** -* Returns the last element in an array for which a predicate function returns a truthy value. -* -* @name findLast -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} predicate - predicate function -* @param {*} [thisArg] - predicate function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {(boolean|void)} array element or undefined -* -* @example -* function predicate( v ) { -* return v === true; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var v = arr.findLast( predicate ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'findLast', function findLast( predicate, thisArg ) { - var buf; - var v; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); - } - buf = this._buffer; - for ( i = this._length-1; i >= 0; i-- ) { - v = Boolean( buf[ i ] ); - if ( predicate.call( thisArg, v, i, this ) ) { - return v; - } - } -}); - -/** -* Returns the index of the last element in an array for which a predicate function returns a truthy value. -* -* @name findLastIndex -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} predicate - predicate function -* @param {*} [thisArg] - predicate function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {integer} index or -1 -* -* @example -* function predicate( v ) { -* return v === true; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var v = arr.findLastIndex( predicate ); -* // returns 2 -*/ -setReadOnly( BooleanArray.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) { - var buf; - var v; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); - } - buf = this._buffer; - for ( i = this._length-1; i >= 0; i-- ) { - v = Boolean( buf[ i ] ); - if ( predicate.call( thisArg, v, i, this ) ) { - return i; - } - } - return -1; -}); - -/** -* Invokes a function once for each array element. -* -* @name forEach -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} fcn - function to invoke -* @param {*} [thisArg] - function invocation context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* -* @example -* function log( v, i ) { -* console.log( '%s: %s', i, v.toString() ); -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* arr.forEach( log ); -*/ -setReadOnly( BooleanArray.prototype, 'forEach', function forEach( fcn, thisArg ) { - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) ); - } - buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - fcn.call( thisArg, Boolean( buf[ i ] ), i, this ); - } -}); - -/** -* Returns an array element. -* -* @name get -* @memberof BooleanArray.prototype -* @type {Function} -* @param {NonNegativeInteger} idx - element index -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} must provide a nonnegative integer -* @returns {(boolean|void)} array element -* -* @example -* var arr = new BooleanArray( 10 ); -* -* var v = arr.get( 0 ); -* // returns false -* -* arr.set( [ true, false ], 0 ); -* -* v = arr.get( 0 ); -* // returns true -* -* v = arr.get( 100 ); -* // returns undefined -*/ -setReadOnly( BooleanArray.prototype, 'get', function get( idx ) { - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isNonNegativeInteger( idx ) ) { - throw new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) ); - } - if ( idx >= this._length ) { - return; - } - return Boolean( this._buffer[ idx ] ); -}); - -/** -* Returns a boolean indicating whether an array includes a provided value. -* -* @name includes -* @memberof BooleanArray.prototype -* @type {Function} -* @param {boolean} searchElement - search element -* @param {integer} [fromIndex=0] - starting index (inclusive) -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a boolean value -* @throws {TypeError} second argument must be an integer -* @returns {boolean} boolean indicating whether an array includes a value -* -* @example -* var arr = new BooleanArray( 5 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* arr.set( true, 3 ); -* arr.set( true, 4 ); -* -* var bool = arr.includes( true ); -* // returns true -* -* bool = arr.includes( false, 2 ); -* // returns false -*/ -setReadOnly( BooleanArray.prototype, 'includes', function includes( searchElement, fromIndex ) { - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isBoolean( searchElement ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) ); - } - if ( arguments.length > 1 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) ); - } - if ( fromIndex < 0 ) { - fromIndex += this._length; - if ( fromIndex < 0 ) { - fromIndex = 0; - } - } - } else { - fromIndex = 0; - } - buf = this._buffer; - for ( i = fromIndex; i < this._length; i++ ) { - if ( searchElement === Boolean( buf[ i ] ) ) { - return true; - } - } - return false; -}); - -/** -* Returns the first index at which a given element can be found. -* -* @name indexOf -* @memberof BooleanArray.prototype -* @type {Function} -* @param {boolean} searchElement - element to find -* @param {integer} [fromIndex=0] - starting index (inclusive) -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a boolean value -* @throws {TypeError} second argument must be an integer -* @returns {integer} index or -1 -* -* @example -* var arr = new BooleanArray( 5 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* arr.set( true, 3 ); -* arr.set( true, 4 ); -* -* var idx = arr.indexOf( true ); -* // returns 0 -* -* idx = arr.indexOf( false, 2 ); -* // returns -1 -* -* idx = arr.indexOf( false, -3 ); -* // returns -1 -*/ -setReadOnly( BooleanArray.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) { - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isBoolean( searchElement ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) ); - } - if ( arguments.length > 1 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) ); - } - if ( fromIndex < 0 ) { - fromIndex += this._length; - if ( fromIndex < 0 ) { - fromIndex = 0; - } - } - } else { - fromIndex = 0; - } - buf = this._buffer; - for ( i = fromIndex; i < this._length; i++ ) { - if ( searchElement === Boolean( buf[ i ] ) ) { - return i; - } - } - return -1; -}); - -/** -* Returns a new string by concatenating all array elements. -* -* @name join -* @memberof BooleanArray.prototype -* @type {Function} -* @param {string} [separator=','] - element separator -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a string -* @returns {string} string representation -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var str = arr.join(); -* // returns 'true,false,true' -* -* str = arr.join( '|' ); -* // returns 'true|false|true' -*/ -setReadOnly( BooleanArray.prototype, 'join', function join( separator ) { - var buf; - var out; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( arguments.length > 0 ) { - if ( !isString( separator ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) ); - } - } else { - separator = ','; - } - buf = this._buffer; - out = []; - for ( i = 0; i < this._length; i++ ) { - if ( buf[i] ) { - out.push( 'true' ); - } else { - out.push( 'false' ); - } - } - return out.join( separator ); -}); - -/** -* Returns an iterator for iterating over each index key in a typed array. -* -* @name keys -* @memberof BooleanArray.prototype -* @type {Function} -* @throws {TypeError} `this` must be a boolean array -* @returns {Iterator} iterator -* -* @example -* var arr = new BooleanArray( 2 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* -* var iter = arr.keys(); -* -* var v = iter.next().value; -* // returns 0 -* -* v = iter.next().value; -* // returns 1 -* -* var bool = iter.next().done; -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'keys', function keys() { - var self; - var iter; - var len; - var FLG; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - self = this; - len = this._length; - - // Initialize an iteration index: - i = -1; - - // Create an iterator protocol-compliant object: - iter = {}; - setReadOnly( iter, 'next', next ); - setReadOnly( iter, 'return', end ); - - if ( ITERATOR_SYMBOL ) { - setReadOnly( iter, ITERATOR_SYMBOL, factory ); - } - return iter; - - /** - * Returns an iterator protocol-compliant object containing the next iterated value. - * - * @private - * @returns {Object} iterator protocol-compliant object - */ - function next() { - i += 1; - if ( FLG || i >= len ) { - return { - 'done': true - }; - } - return { - 'value': i, - 'done': false - }; - } - - /** - * Finishes an iterator. - * - * @private - * @param {*} [value] - value to return - * @returns {Object} iterator protocol-compliant object - */ - function end( value ) { - FLG = true; - if ( arguments.length ) { - return { - 'value': value, - 'done': true - }; - } - return { - 'done': true - }; - } - - /** - * Returns a new iterator. - * - * @private - * @returns {Iterator} iterator - */ - function factory() { - return self.keys(); - } -}); - -/** -* Returns the last index at which a given element can be found. -* -* @name lastIndexOf -* @memberof BooleanArray.prototype -* @type {Function} -* @param {boolean} searchElement - element to find -* @param {integer} [fromIndex] - starting index (inclusive) -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a boolean value -* @throws {TypeError} second argument must be an integer -* @returns {integer} index or -1 -* -* @example -* var arr = new BooleanArray( 5 ); -* -* arr.set( true, 0 ); -* arr.set( true, 1 ); -* arr.set( true, 2 ); -* arr.set( false, 3 ); -* arr.set( true, 4 ); -* -* var idx = arr.lastIndexOf( true ); -* // returns 4 -* -* idx = arr.lastIndexOf( false, 2 ); -* // returns -1 -* -* idx = arr.lastIndexOf( false, -3 ); -* // returns -1 -*/ -setReadOnly( BooleanArray.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) { - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isBoolean( searchElement ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a boolean. Value: `%s`.', searchElement ) ); - } - if ( arguments.length > 1 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) ); - } - if ( fromIndex >= this._length ) { - fromIndex = this._length - 1; - } else if ( fromIndex < 0 ) { - fromIndex += this._length; - } - } else { - fromIndex = this._length - 1; - } - buf = this._buffer; - for ( i = fromIndex; i >= 0; i-- ) { - if ( searchElement === Boolean( buf[ i ] ) ) { - return i; - } - } - return -1; -}); - -/** -* Number of array elements. -* -* @name length -* @memberof BooleanArray.prototype -* @readonly -* @type {NonNegativeInteger} -* -* @example -* var arr = new BooleanArray( 10 ); -* -* var len = arr.length; -* // returns 10 -*/ -setReadOnlyAccessor( BooleanArray.prototype, 'length', function get() { - return this._length; -}); - -/** -* Returns a new array with each element being the result of a provided callback function. -* -* @name map -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} fcn - callback function -* @param {*} [thisArg] - callback function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {BooleanArray} new boolean array -* -* @example -* function invert( v ) { -* return !v; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var out = arr.map( invert ); -* // returns -* -* var z = out.get( 0 ); -* // returns false -* -* z = out.get( 1 ); -* // returns true -* -* z = out.get( 2 ); -* // returns false -*/ -setReadOnly( BooleanArray.prototype, 'map', function map( fcn, thisArg ) { - var outbuf; - var out; - var buf; - var i; - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( fcn ) ) { - throw new TypeError( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ); - } - buf = this._buffer; - out = new this.constructor( this._length ); - outbuf = out._buffer; // eslint-disable-line no-underscore-dangle - for ( i = 0; i < this._length; i++ ) { - outbuf[ i ] = Boolean( fcn.call( thisArg, Boolean( buf[ i ] ), i, this ) ); - } - return out; -}); - -/** -* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion. -* -* @name reduce -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} reducer - callback function -* @param {*} [initialValue] - initial value -* @throws {TypeError} `this` must be a boolean array -* @throws {Error} if not provided an initial value, the array must have at least one element -* @returns {*} accumulated result -* -* @example -* function reducer( acc, v ) { -* if ( v ) { -* return acc + 1; -* } -* return acc; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var out = arr.reduce( reducer, 0 ); -* // returns 2 -*/ -setReadOnly( BooleanArray.prototype, 'reduce', function reduce( reducer, initialValue ) { - var buf; - var len; - var acc; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( reducer ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) ); - } - buf = this._buffer; - len = this._length; - if ( arguments.length > 1 ) { - acc = initialValue; - i = 0; - } else { - if ( len === 0 ) { - throw new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' ); - } - acc = Boolean( buf[ 0 ] ); - i = 1; - } - for ( ; i < len; i++ ) { - acc = reducer( acc, Boolean( buf[ i ] ), i, this ); - } - return acc; -}); - -/** -* Applies a provided callback function to each element of the array, in reverse order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion. -* -* @name reduceRight -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} reducer - callback function -* @param {*} [initialValue] - initial value -* @throws {TypeError} `this` must be a boolean array -* @throws {Error} if not provided an initial value, the array must have at least one element -* @returns {*} accumulated result -* -* @example -* function reducer( acc, v ) { -* if ( v ) { -* return acc + 1; -* } -* return acc; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var out = arr.reduceRight( reducer, 0 ); -* // returns 2 -*/ -setReadOnly( BooleanArray.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) { - var buf; - var len; - var acc; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( reducer ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) ); - } - buf = this._buffer; - len = this._length; - if ( arguments.length > 1 ) { - acc = initialValue; - i = len - 1; - } else { - if ( len === 0 ) { - throw new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' ); - } - acc = Boolean( buf[ len-1 ] ); - i = len - 2; - } - for ( ; i >= 0; i-- ) { - acc = reducer( acc, Boolean( buf[ i ] ), i, this ); - } - return acc; -}); - -/** -* Reverses an array in-place. -* -* @name reverse -* @memberof BooleanArray.prototype -* @type {Function} -* @throws {TypeError} `this` must be a boolean array -* @returns {BooleanArray} reversed array -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( false, 2 ); -* -* var out = arr.reverse(); -* // returns -* -* var v = out.get( 0 ); -* // returns false -* -* v = out.get( 1 ); -* // returns false -* -* v = out.get( 2 ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'reverse', function reverse() { - var buf; - var tmp; - var len; - var N; - var i; - var j; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - buf = this._buffer; - len = this._length; - N = floor( len / 2 ); - for ( i = 0; i < N; i++ ) { - j = len - i - 1; - tmp = buf[ i ]; - buf[ i ] = buf[ j ]; - buf[ j ] = tmp; - } - return this; -}); - -/** -* Sets an array element. -* -* ## Notes -* -* - When provided a typed array, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario: -* -* ```text -* buf: --------------------- -* src: --------------------- -* ``` -* -* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array. -* -* In the other overlapping scenario, -* -* ```text -* buf: --------------------- -* src: --------------------- -* ``` -* -* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended. -* -* @name set -* @memberof BooleanArray.prototype -* @type {Function} -* @param {(Collection|BooleanArray|*)} value - value(s) -* @param {NonNegativeInteger} [i=0] - element index at which to start writing values -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} index argument must be a nonnegative integer -* @throws {RangeError} index argument is out-of-bounds -* @throws {RangeError} target array lacks sufficient storage to accommodate source values -* @returns {void} -* -* @example -* var arr = new BooleanArray( 10 ); -* -* var v = arr.get( 0 ); -* // returns false -* -* arr.set( [ true, false ], 0 ); -* -* v = arr.get( 0 ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'set', function set( value ) { - var sbuf; - var idx; - var buf; - var tmp; - var N; - var i; - var j; - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - buf = this._buffer; - if ( arguments.length > 1 ) { - idx = arguments[ 1 ]; - if ( !isNonNegativeInteger( idx ) ) { - throw new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) ); - } - } else { - idx = 0; - } - if ( isCollection( value ) ) { - N = value.length; - if ( idx+N > this._length ) { - throw new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' ); - } - if ( isBooleanArray( value ) ) { - sbuf = value._buffer; // eslint-disable-line no-underscore-dangle - } else { - sbuf = value; - } - // Check for overlapping memory... - j = buf.byteOffset + (idx*BYTES_PER_ELEMENT); - if ( - sbuf.buffer === buf.buffer && - ( - sbuf.byteOffset < j && - sbuf.byteOffset+sbuf.byteLength > j - ) - ) { - // We need to copy source values... - tmp = new Uint8Array( sbuf.length ); - for ( i = 0; i < sbuf.length; i++ ) { - tmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays - } - sbuf = tmp; - } - for ( i = 0; i < N; idx++, i++ ) { - buf[ idx ] = ( sbuf[ i ] ) ? 1 : 0; - } - return; - } - if ( idx >= this._length ) { - throw new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) ); - } - buf[ idx ] = ( value ) ? 1 : 0; -}); - -/** -* Copies a portion of a typed array to a new typed array. -* -* @name slice -* @memberof BooleanArray.prototype -* @type {Function} -* @param {integer} [begin] - start index (inclusive) -* @param {integer} [end] - end index (exclusive) -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be integer -* @throws {TypeError} second argument must be integer -* @returns {BooleanArray} boolean array -* -* @example -* var arr = new BooleanArray( 5 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* arr.set( false, 3 ); -* arr.set( true, 4 ); -* -* var out = arr.slice(); -* // returns -* -* var len = out.length; -* // returns 5 -* -* var bool = out.get( 0 ); -* // returns true -* -* bool = out.get( len-1 ); -* // returns true -* -* out = arr.slice( 1, -2 ); -* // returns -* -* len = out.length; -* // returns 2 -* -* bool = out.get( 0 ); -* // returns false -* -* bool = out.get( len-1 ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'slice', function slice( begin, end ) { - var outlen; - var outbuf; - var out; - var buf; - var len; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - buf = this._buffer; - len = this._length; - if ( arguments.length === 0 ) { - begin = 0; - end = len; - } else { - if ( !isInteger( begin ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) ); - } - if ( begin < 0 ) { - begin += len; - if ( begin < 0 ) { - begin = 0; - } - } - if ( arguments.length === 1 ) { - end = len; - } else { - if ( !isInteger( end ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) ); - } - if ( end < 0 ) { - end += len; - if ( end < 0 ) { - end = 0; - } - } else if ( end > len ) { - end = len; - } - } - } - if ( begin < end ) { - outlen = end - begin; - } else { - outlen = 0; - } - out = new this.constructor( outlen ); - outbuf = out._buffer; // eslint-disable-line no-underscore-dangle - for ( i = 0; i < outlen; i++ ) { - outbuf[ i ] = buf[ i+begin ]; - } - return out; -}); - -/** -* Tests whether at least one element in an array passes a test implemented by a predicate function. -* -* @name some -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} predicate - predicate function -* @param {*} [thisArg] - predicate function execution context -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {boolean} boolean indicating whether at least one element passes a test -* -* @example -* function predicate( v ) { -* return v === true; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( false, 0 ); -* arr.set( true, 1 ); -* arr.set( false, 2 ); -* -* var bool = arr.some( predicate ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'some', function some( predicate, thisArg ) { - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); - } - buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - if ( predicate.call( thisArg, Boolean( buf[ i ] ), i, this ) ) { - return true; - } - } - return false; -}); - -/** -* Sorts an array in-place. -* -* @name sort -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} [compareFcn] - comparison function -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {BooleanArray} sorted array -* -* @example -* function compare( a, b ) { -* if ( a === false ) { -* if ( b === false ) { -* return 0; -* } -* return 1; -* } -* if ( b === true ) { -* return 0; -* } -* return -1; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* arr.sort( compare ); -* -* var v = arr.get( 0 ); -* // returns true -* -* v = arr.get( 1 ); -* // returns true -* -* v = arr.get( 2 ); -* // returns false -*/ -setReadOnly( BooleanArray.prototype, 'sort', function sort( compareFcn ) { - var buf; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - buf = this._buffer; - if ( arguments.length === 0 ) { - buf.sort(); - return this; - } - if ( !isFunction( compareFcn ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', compareFcn ) ); - } - buf.sort( compare ); - return this; - - /** - * Comparison function for sorting. - * - * @private - * @param {boolean} a - first boolean value for comparison - * @param {boolean} b - second boolean value for comparison - * @returns {number} comparison result - */ - function compare( a, b ) { - return compareFcn( Boolean( a ), Boolean( b ) ); - } -}); - -/** -* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array. -* -* @name subarray -* @memberof BooleanArray.prototype -* @type {Function} -* @param {integer} [begin] - start index (inclusive) -* @param {integer} [end] - end index (exclusive) -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be an integer -* @throws {TypeError} second argument must be an integer -* @returns {BooleanArray} subarray -* -* @example -* var arr = new BooleanArray( 5 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* arr.set( false, 3 ); -* arr.set( true, 4 ); -* -* var subarr = arr.subarray(); -* // returns -* -* var len = subarr.length; -* // returns 5 -* -* var bool = subarr.get( 0 ); -* // returns true -* -* bool = subarr.get( len-1 ); -* // returns true -* -* subarr = arr.subarray( 1, -2 ); -* // returns -* -* len = subarr.length; -* // returns 2 -* -* bool = subarr.get( 0 ); -* // returns false -* -* bool = subarr.get( len-1 ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'subarray', function subarray( begin, end ) { - var offset; - var buf; - var len; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - buf = this._buffer; - len = this._length; - if ( arguments.length === 0 ) { - begin = 0; - end = len; - } else { - if ( !isInteger( begin ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) ); - } - if ( begin < 0 ) { - begin += len; - if ( begin < 0 ) { - begin = 0; - } - } - if ( arguments.length === 1 ) { - end = len; - } else { - if ( !isInteger( end ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) ); - } - if ( end < 0 ) { - end += len; - if ( end < 0 ) { - end = 0; - } - } else if ( end > len ) { - end = len; - } - } - } - if ( begin >= len ) { - len = 0; - offset = buf.byteLength; - } else if ( begin >= end ) { - len = 0; - offset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT ); - } else { - len = end - begin; - offset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT ); - } - return new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len ); -}); - -/** -* Serializes an array as a locale-specific string. -* -* @name toLocaleString -* @memberof BooleanArray.prototype -* @type {Function} -* @param {(string|Array)} [locales] - locale identifier(s) -* @param {Object} [options] - configuration options -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a string or an array of strings -* @throws {TypeError} options argument must be an object -* @returns {string} string representation -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var str = arr.toLocaleString(); -* // returns 'true,false,true' -*/ -setReadOnly( BooleanArray.prototype, 'toLocaleString', function toLocaleString( locales, options ) { - var opts; - var loc; - var out; - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( arguments.length === 0 ) { - loc = []; - } else if ( isString( locales ) || isStringArray( locales ) ) { - loc = locales; - } else { - throw new TypeError( format( 'invalid argument. First argument must be a string or an array of strings. Value: `%s`.', locales ) ); - } - if ( arguments.length < 2 ) { - opts = {}; - } else if ( isObject( options ) ) { - opts = options; - } else { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - buf = this._buffer; - out = []; - for ( i = 0; i < this._length; i++ ) { - out.push( Boolean( buf[ i ] ).toLocaleString( loc, opts ) ); - } - return out.join( ',' ); -}); - -/** -* Returns a new typed array containing the elements in reversed order. -* -* @name toReversed -* @memberof BooleanArray.prototype -* @type {Function} -* @throws {TypeError} `this` must be a boolean array -* @returns {BooleanArray} reversed array -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( false, 2 ); -* -* var out = arr.toReversed(); -* // returns -* -* var v = out.get( 0 ); -* // returns false -* -* v = out.get( 1 ); -* // returns false -* -* v = out.get( 2 ); -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'toReversed', function toReversed() { - var outbuf; - var out; - var len; - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - len = this._length; - out = new this.constructor( len ); - buf = this._buffer; - outbuf = out._buffer; // eslint-disable-line no-underscore-dangle - for ( i = 0; i < len; i++ ) { - outbuf[ i ] = buf[ len - i - 1 ]; - } - return out; -}); - -/** -* Returns a new typed array containing the elements in sorted order. -* -* @name toSorted -* @memberof BooleanArray.prototype -* @type {Function} -* @param {Function} [compareFcn] - comparison function -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be a function -* @returns {BooleanArray} sorted array -* -* @example -* function compare( a, b ) { -* if ( a === false ) { -* if ( b === false ) { -* return 0; -* } -* return 1; -* } -* if ( b === true ) { -* return 0; -* } -* return -1; -* } -* -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var out = arr.sort( compare ); -* // returns -* -* var v = out.get( 0 ); -* // returns true -* -* v = out.get( 1 ); -* // returns true -* -* v = out.get( 2 ); -* // returns false -*/ -setReadOnly( BooleanArray.prototype, 'toSorted', function toSorted( compareFcn ) { - var outbuf; - var out; - var len; - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - len = this._length; - out = new this.constructor( len ); - buf = this._buffer; - outbuf = out._buffer; // eslint-disable-line no-underscore-dangle - for ( i = 0; i < len; i++ ) { - outbuf[ i ] = buf[ i ]; - } - if ( arguments.length === 0 ) { - outbuf.sort(); - return out; - } - if ( !isFunction( compareFcn ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', compareFcn ) ); - } - outbuf.sort( compare ); - return out; - - /** - * Comparison function for sorting. - * - * @private - * @param {boolean} a - first boolean value for comparison - * @param {boolean} b - second boolean value for comparison - * @returns {number} comparison result - */ - function compare( a, b ) { - return compareFcn( Boolean( a ), Boolean( b ) ); - } -}); - -/** -* Serializes an array as a string. -* -* @name toString -* @memberof BooleanArray.prototype -* @type {Function} -* @throws {TypeError} `this` must be a boolean array -* @returns {string} string representation -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var str = arr.toString(); -* // returns 'true,false,true' -*/ -setReadOnly( BooleanArray.prototype, 'toString', function toString() { - var out; - var buf; - var i; - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - out = []; - buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - if ( buf[i] ) { - out.push( 'true' ); - } else { - out.push( 'false' ); - } - } - return out.join( ',' ); -}); - -/** -* Returns an iterator for iterating over each value in a typed array. -* -* @name values -* @memberof BooleanArray.prototype -* @type {Function} -* @throws {TypeError} `this` must be a boolean array -* @returns {Iterator} iterator -* -* @example -* var arr = new BooleanArray( 2 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* -* var iter = arr.values(); -* -* var v = iter.next().value; -* // returns true -* -* v = iter.next().value; -* // returns false -* -* var bool = iter.next().done; -* // returns true -*/ -setReadOnly( BooleanArray.prototype, 'values', function values() { - var iter; - var self; - var len; - var FLG; - var buf; - var i; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - self = this; - buf = this._buffer; - len = this._length; - - // Initialize an iteration index: - i = -1; - - // Create an iterator protocol-compliant object: - iter = {}; - setReadOnly( iter, 'next', next ); - setReadOnly( iter, 'return', end ); - - if ( ITERATOR_SYMBOL ) { - setReadOnly( iter, ITERATOR_SYMBOL, factory ); - } - return iter; - - /** - * Returns an iterator protocol-compliant object containing the next iterated value. - * - * @private - * @returns {Object} iterator protocol-compliant object - */ - function next() { - i += 1; - if ( FLG || i >= len ) { - return { - 'done': true - }; - } - return { - 'value': Boolean( buf[ i ] ), - 'done': false - }; - } - - /** - * Finishes an iterator. - * - * @private - * @param {*} [value] - value to return - * @returns {Object} iterator protocol-compliant object - */ - function end( value ) { - FLG = true; - if ( arguments.length ) { - return { - 'value': value, - 'done': true - }; - } - return { - 'done': true - }; - } - - /** - * Returns a new iterator. - * - * @private - * @returns {Iterator} iterator - */ - function factory() { - return self.values(); - } -}); - -/** -* Returns a new typed array with the element at a provided index replaced with a provided value. -* -* @name with -* @memberof BooleanArray.prototype -* @type {Function} -* @param {integer} index - element index -* @param {boolean} value - new value -* @throws {TypeError} `this` must be a boolean array -* @throws {TypeError} first argument must be an integer -* @throws {RangeError} index argument is out-of-bounds -* @throws {TypeError} second argument must be a boolean -* @returns {BooleanArray} new typed array -* -* @example -* var arr = new BooleanArray( 3 ); -* -* arr.set( true, 0 ); -* arr.set( false, 1 ); -* arr.set( true, 2 ); -* -* var out = arr.with( 0, false ); -* // returns -* -* var v = out.get( 0 ); -* // returns false -*/ -setReadOnly( BooleanArray.prototype, 'with', function copyWith( index, value ) { - var buf; - var out; - var len; - - if ( !isBooleanArray( this ) ) { - throw new TypeError( 'invalid invocation. `this` is not a boolean array.' ); - } - if ( !isInteger( index ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', index ) ); - } - len = this._length; - if ( index < 0 ) { - index += len; - } - if ( index < 0 || index >= len ) { - throw new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%s`.', index ) ); - } - if ( !isBoolean( value ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a boolean. Value: `%s`.', value ) ); - } - out = new this.constructor( this._buffer ); - buf = out._buffer; // eslint-disable-line no-underscore-dangle - if ( value ) { - buf[ index ] = 1; - } else { - buf[ index ] = 0; - } - return out; -}); - - -// EXPORTS // - -module.exports = BooleanArray; diff --git a/package.json b/package.json index 44b73ef..9b762ea 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.2", "description": "BooleanArray.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,62 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-accessor-getter": "^0.2.3", - "@stdlib/array-base-getter": "^0.2.3", - "@stdlib/array-uint8": "^0.2.3", - "@stdlib/assert-has-iterator-symbol-support": "^0.2.3", - "@stdlib/assert-is-arraybuffer": "^0.2.3", - "@stdlib/assert-is-boolean": "^0.2.3", - "@stdlib/assert-is-collection": "^0.2.3", - "@stdlib/assert-is-function": "^0.2.3", - "@stdlib/assert-is-integer": "^0.2.3", - "@stdlib/assert-is-nonnegative-integer": "^0.2.3", - "@stdlib/assert-is-object": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/assert-is-string-array": "^0.2.3", - "@stdlib/boolean-ctor": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/string-format": "^0.2.3", - "@stdlib/symbol-iterator": "^0.2.3", - "@stdlib/types": "^0.5.1", - "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.2.4", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/assert-has-own-property": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-array": "^0.2.3", - "@stdlib/assert-is-booleanarray": "^0.0.3", - "@stdlib/assert-is-iterator-like": "^0.2.3", - "@stdlib/console-log-each": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-randu": "^0.2.3", - "@stdlib/strided-base-reinterpret-boolean": "^0.0.3", - "@stdlib/utils-identity-function": "^0.2.3", - "proxyquire": "^2.0.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..c747a12 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..e73140b --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.at.js b/test/test.at.js deleted file mode 100644 index f1ed54e..0000000 --- a/test/test.at.js +++ /dev/null @@ -1,136 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is an `at` method for returning an array element', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'at' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.at ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.at.call( value, 0 ); - }; - } -}); - -tape( 'the method throws an error if provided an index argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.at( value ); - }; - } -}); - -tape( 'the method returns `undefined` if provided an index which exceeds array dimensions', function test( t ) { - var arr; - var v; - var i; - - arr = new BooleanArray( 10 ); - for ( i = -arr.length; i < arr.length; i++ ) { - if ( i < 0 ) { - v = arr.at( i-arr.length ); - t.strictEqual( v, void 0, 'returns expected value for index '+(i-arr.length) ); - } else { - v = arr.at( arr.length+i ); - t.strictEqual( v, void 0, 'returns expected value for index '+(arr.length+i) ); - } - } - t.end(); -}); - -tape( 'the method returns an array element', function test( t ) { - var expected; - var arr; - var v; - var i; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = [ true, false, true, false, true, true, false, true, false, true ]; - - for ( i = -arr.length; i < arr.length; i++ ) { - v = arr.at( i ); - t.strictEqual( v, expected[ i+arr.length ], 'returns expected value' ); - } - t.end(); -}); diff --git a/test/test.copy_within.js b/test/test.copy_within.js deleted file mode 100644 index 16d4894..0000000 --- a/test/test.copy_within.js +++ /dev/null @@ -1,215 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `copyWithin` method for copying a sequence of array elements within a boolean array', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'copyWithin' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.copyWithin ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.copyWithin.call( value, 3, 0 ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance (end)', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.copyWithin.call( value, 3, 0, 5 ); - }; - } -}); - -tape( 'the method copies a sequence of elements within an array', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( 0, 5 ); - - expected = new Uint8Array( [ 0, 0, 1, 1, 1, 0, 0, 1 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within an array (negative target)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( -arr.length, 5 ); - - expected = new Uint8Array( [ 0, 0, 1, 1, 1, 0, 0, 1 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within an array (negative start)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( 0, -3 ); - - expected = new Uint8Array( [ 0, 0, 1, 1, 1, 0, 0, 1 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within an array (end=length)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( 0, 5, arr.length ); - - expected = new Uint8Array( [ 0, 0, 1, 1, 1, 0, 0, 1 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within an array (non-inclusive end)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( 2, 0, 4 ); - - expected = new Uint8Array( [ 1, 0, 1, 0, 0, 1, 0, 1 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within an array (negative end)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( 2, 0, -4 ); - - expected = new Uint8Array( [ 1, 0, 1, 0, 0, 1, 0, 1 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within an array (target >= length)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( arr.length, 5 ); - - expected = new Uint8Array( [ 1, 0, 0, 1, 1, 0, 0, 1 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method copies a sequence of elements within an array (target > start)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false, false, true ] ); - arr.copyWithin( 2, 0 ); - - expected = new Uint8Array( [ 1, 0, 1, 0, 0, 1, 1, 0 ] ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.entries.js b/test/test.entries.js deleted file mode 100644 index 8ea46ec..0000000 --- a/test/test.entries.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is an `entries` method for returning an iterator for iterating over array key-value pairs', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'entries' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.entries ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.entries.call( value ); - }; - } -}); - -tape( 'the method returns an iterator protocol-compliant object', function test( t ) { - var buf; - var arr; - var it; - var v; - var i; - - buf = [ true, false, false, true ]; - arr = new BooleanArray( buf ); - - it = arr.entries(); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - for ( i = 0; i < arr.length; i++ ) { - v = it.next(); - t.strictEqual( isArray( v.value ), true, 'returns expected value' ); - t.strictEqual( v.value[ 0 ], i, 'returns expected value' ); - t.strictEqual( isBoolean( v.value[ 1 ] ), true, 'returns expected value' ); - t.strictEqual( v.value[ 1 ], buf[ i ], 'returns expected value' ); - t.strictEqual( typeof v.done, 'boolean', 'returns expected value' ); - } - t.end(); -}); - -tape( 'the method returns an iterator which has a `return` method for closing an iterator (no argument)', function test( t ) { - var buf; - var arr; - var it; - var v; - - buf = [ true, false, false, true ]; - arr = new BooleanArray( buf ); - - it = arr.entries(); - - v = it.next(); - t.strictEqual( v.value[ 1 ], buf[ 0 ], 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value[ 1 ], buf[ 1 ], 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.return(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method returns an iterator which has a `return` method for closing an iterator (argument)', function test( t ) { - var buf; - var arr; - var it; - var v; - - buf = [ true, false, false, true ]; - arr = new BooleanArray( buf ); - - it = arr.entries(); - - v = it.next(); - t.strictEqual( v.value[ 1 ], buf[ 0 ], 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value[ 1 ], buf[ 1 ], 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.return( 'finished' ); - t.strictEqual( v.value, 'finished', 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if an environment supports `Symbol.iterator`, the method returns an iterable', function test( t ) { - var BooleanArray; - var arr; - var buf; - var it1; - var it2; - var v1; - var v2; - var i; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/symbol-iterator': '__ITERATOR_SYMBOL__' - }); - - buf = [ true, false, false, true ]; - arr = new BooleanArray( buf ); - - it1 = arr.entries(); - t.strictEqual( typeof it1[ '__ITERATOR_SYMBOL__' ], 'function', 'has method' ); - t.strictEqual( it1[ '__ITERATOR_SYMBOL__' ].length, 0, 'has zero arity' ); - - it2 = it1[ '__ITERATOR_SYMBOL__' ](); - t.strictEqual( typeof it2, 'object', 'returns expected value' ); - t.strictEqual( typeof it2.next, 'function', 'has `next` method' ); - t.strictEqual( typeof it2.return, 'function', 'has `return` method' ); - - for ( i = 0; i < arr.length; i++ ) { - v1 = it1.next().value; - v2 = it2.next().value; - t.strictEqual( v1[ 0 ], v2[ 0 ], 'returns expected value' ); - t.strictEqual( v1[ 1 ], v2[ 1 ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'if an environment does not support `Symbol.iterator`, the method does not return an "iterable"', function test( t ) { - var BooleanArray; - var arr; - var buf; - var it; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/symbol-iterator': false - }); - - buf = [ true, false, false, true ]; - arr = new BooleanArray( buf ); - - it = arr.entries(); - t.strictEqual( it[ ITERATOR_SYMBOL ], void 0, 'does not have property' ); - - t.end(); -}); diff --git a/test/test.every.js b/test/test.every.js deleted file mode 100644 index 0bb8a18..0000000 --- a/test/test.every.js +++ /dev/null @@ -1,173 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is an `every` method for returning boolean indicating whether all elements pass a test', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'every' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.every ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.every.call( value, predicate ); - }; - } - - function predicate( v ) { - return v === true; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.every( value ); - }; - } -}); - -tape( 'the method returns `true` if operating on an empty boolean array', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray(); - bool = arr.every( predicate ); - - t.strictEqual( bool, true, 'returns expected value' ); - t.end(); - - function predicate() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the method returns `true` if all elements pass a test', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ true, true, true, true ] ); - bool = arr.every( predicate ); - - t.strictEqual( bool, true, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return v === true; - } -}); - -tape( 'the method returns `false` if one or more elements fail a test', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ true, false, true, false ] ); - bool = arr.every( predicate ); - - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return v === true; - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var bool; - var ctx; - var arr; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ true, true, true, true ] ); - bool = arr.every( predicate, ctx ); - - t.strictEqual( bool, true, 'returns expected value' ); - t.strictEqual( ctx.count, 4, 'returns expected value' ); - - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return v === true; - } -}); diff --git a/test/test.fill.js b/test/test.fill.js deleted file mode 100644 index 6e40f6a..0000000 --- a/test/test.fill.js +++ /dev/null @@ -1,280 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `fill` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'fill' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.fill ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.fill.call( value, true ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a boolean', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.fill( value ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.fill( true, value ); - }; - } -}); - -tape( 'the method throws an error if provided a third argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.fill( true, 0, value ); - }; - } -}); - -tape( 'the method returns an empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.fill( true ); - - t.strictEqual( out instanceof BooleanArray, true, 'returns expected value' ); - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the method does not change the array length', function test( t ) { - var arr; - var out; - - arr = new BooleanArray( 10 ); - out = arr.fill( true ); - - t.strictEqual( out, arr, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'if called with one argument, the method sets each array element to the provided value', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( 3 ); - expected = new Uint8Array( [ 1, 1, 1 ] ); - - arr.fill( true ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if called with two arguments, the method sets each array element to the provided value starting from a start index (inclusive)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( 3 ); - expected = new Uint8Array( [ 0, 1, 1 ] ); - - arr.fill( true, 1 ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if called with three arguments, the method sets each array element to the provided value starting from a start index (inclusive) until a specified end index (exclusive)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( 3 ); - expected = new Uint8Array( [ 1, 1, 0 ] ); - - arr.fill( true, 0, 2 ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method supports negative indices', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( 3 ); - expected = new Uint8Array( [ 1, 1, 0 ] ); - - arr.fill( true, -3, -1 ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if a provided start index resolves to a negative index, the method fills an array starting from the first element', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( 3 ); - expected = new Uint8Array( [ 1, 1, 1 ] ); - - arr.fill( true, -10 ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if a provided end index resolves to an index exceeding the last array element index, the method fills an array until the last element (inclusive)', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( 3 ); - expected = new Uint8Array( [ 0, 1, 1 ] ); - - arr.fill( true, 1, 10 ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if a provided start index resolves to an index which is greater than or equal to a resolved end index, the method does not fill an array', function test( t ) { - var expected; - var arr; - - arr = new BooleanArray( 3 ); - expected = new Uint8Array( [ 0, 0, 0 ] ); - - arr.fill( true, 2, 1 ); - - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.filter.js b/test/test.filter.js deleted file mode 100644 index 4294e79..0000000 --- a/test/test.filter.js +++ /dev/null @@ -1,208 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `filter` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'filter' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.filter ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.filter.call( value, predicate ); - }; - } - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.filter( value ); - }; - } -}); - -tape( 'the method returns an empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.filter( predicate ); - - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method returns a new boolean array containing only those elements which satisfy a test condition', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true ] ); - expected = new Uint8Array( [ 1, 1 ] ); - actual = arr.filter( predicate ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method copies all elements to a new array if all elements satisfy a test condition', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, true, true, true ] ); - expected = new Uint8Array( [ 1, 1, 1, 1 ] ); - actual = arr.filter( predicate ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.notEqual( actual, arr, 'returns a new instance' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method returns an empty array if no elements satisfy a test condition', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ false, false, false, false ] ); - expected = new Uint8Array( [] ); - actual = arr.filter( predicate ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.notEqual( actual, arr, 'returns a new instance' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var expected; - var actual; - var arr; - var ctx; - - arr = new BooleanArray( [ true, false, true ] ); - expected = new Uint8Array( [ 1, 1 ] ); - ctx = { - 'count': 0 - }; - actual = arr.filter( predicate, ctx ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.strictEqual( ctx.count, 3, 'returns expected value' ); - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return ( v === true ); - } -}); diff --git a/test/test.find.js b/test/test.find.js deleted file mode 100644 index 809593a..0000000 --- a/test/test.find.js +++ /dev/null @@ -1,173 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `find` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'find' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.find ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.find.call( value, predicate ); - }; - } - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.find( value ); - }; - } -}); - -tape( 'the method returns `undefined` if operating on an empty boolean array', function test( t ) { - var arr; - var v; - - arr = new BooleanArray(); - v = arr.find( predicate ); - - t.strictEqual( v, void 0, 'returns expected value' ); - t.end(); - - function predicate() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the method returns the first element which passes a test', function test( t ) { - var arr; - var v; - - arr = new BooleanArray( [ true, false, true, false ] ); - v = arr.find( predicate ); - - t.strictEqual( v, false, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === false ); - } -}); - -tape( 'the method returns `undefined` if all elements fail a test', function test( t ) { - var arr; - var v; - - arr = new BooleanArray( [ true, true, true, true, true ] ); - v = arr.find( predicate ); - - t.strictEqual( v, void 0, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === false ); - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var ctx; - var arr; - var v; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ true, true, false, true, false ] ); - v = arr.find( predicate, ctx ); - - t.strictEqual( v, false, 'returns expected value' ); - t.strictEqual( ctx.count, 3, 'returns expected value' ); - - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return ( v === false ); - } -}); diff --git a/test/test.find_index.js b/test/test.find_index.js deleted file mode 100644 index 975c0db..0000000 --- a/test/test.find_index.js +++ /dev/null @@ -1,173 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `findIndex` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'findIndex' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.findIndex ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.findIndex.call( value, predicate ); - }; - } - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.findIndex( value ); - }; - } -}); - -tape( 'the method returns `-1` if operating on an empty boolean array', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray(); - idx = arr.findIndex( predicate ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); - - function predicate() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the method returns the index of the first element which passes a test', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray( [ false, false, true, true ] ); - idx = arr.findIndex( predicate ); - - t.strictEqual( idx, 2, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method returns `-1` if all elements fail a test', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray( [ false, false, false, false ] ); - idx = arr.findIndex( predicate ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var ctx; - var arr; - var idx; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ false, true, true, false ] ); - idx = arr.findIndex( predicate, ctx ); - - t.strictEqual( idx, 1, 'returns expected value' ); - t.strictEqual( ctx.count, 2, 'returns expected value' ); - - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return ( v === true ); - } -}); diff --git a/test/test.find_last.js b/test/test.find_last.js deleted file mode 100644 index 53da06b..0000000 --- a/test/test.find_last.js +++ /dev/null @@ -1,173 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `findLast` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'findLast' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.findLast ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.findLast.call( value, predicate ); - }; - } - - function predicate( v ) { - return ( v === false ); - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.findLast( value ); - }; - } -}); - -tape( 'the method returns `undefined` if operating on an empty boolean array', function test( t ) { - var arr; - var v; - - arr = new BooleanArray(); - v = arr.findLast( predicate ); - - t.strictEqual( v, void 0, 'returns expected value' ); - t.end(); - - function predicate() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the method returns the last element which passes a test', function test( t ) { - var arr; - var v; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - v = arr.findLast( predicate ); - - t.strictEqual( v, false, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === false ); - } -}); - -tape( 'the method returns `undefined` if all elements fail a test', function test( t ) { - var arr; - var v; - - arr = new BooleanArray( [ true, true, true, true, true ] ); - v = arr.findLast( predicate ); - - t.strictEqual( v, void 0, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === false ); - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var ctx; - var arr; - var v; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ true, true, false, true, false ] ); - v = arr.findLast( predicate, ctx ); - - t.strictEqual( v, true, 'returns expected value' ); - t.strictEqual( ctx.count, 2, 'returns expected value' ); - - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return ( v === true ); - } -}); diff --git a/test/test.find_last_index.js b/test/test.find_last_index.js deleted file mode 100644 index f0acaf4..0000000 --- a/test/test.find_last_index.js +++ /dev/null @@ -1,173 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `findLastIndex` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'findLastIndex' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.findLastIndex ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.findLastIndex.call( value, predicate ); - }; - } - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.findLastIndex( value ); - }; - } -}); - -tape( 'the method returns `-1` if operating on an empty boolean array', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray(); - idx = arr.findLastIndex( predicate ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); - - function predicate() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the method returns the index of the last element which passes a test', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray( [ false, false, true, true ] ); - idx = arr.findLastIndex( predicate ); - - t.strictEqual( idx, 3, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method returns `-1` if all elements fail a test', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray( [ false, false, false, false ] ); - idx = arr.findLastIndex( predicate ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return ( v === true ); - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var ctx; - var arr; - var idx; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ false, true, true, false ] ); - idx = arr.findLastIndex( predicate, ctx ); - - t.strictEqual( idx, 2, 'returns expected value' ); - t.strictEqual( ctx.count, 2, 'returns expected value' ); - - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return ( v === true ); - } -}); diff --git a/test/test.for_each.js b/test/test.for_each.js deleted file mode 100644 index 5824863..0000000 --- a/test/test.for_each.js +++ /dev/null @@ -1,187 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `forEach` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'forEach' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.forEach ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.forEach.call( value, fcn ); - }; - } - - function fcn( v ) { - if ( !isBoolean( v ) ) { - t.fail( 'should be a boolean' ); - } - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.forEach( value ); - }; - } -}); - -tape( 'the method should not invoke a provided callback function if operating on an empty boolean array', function test( t ) { - var arr; - - arr = new BooleanArray(); - arr.forEach( fcn ); - - t.end(); - - function fcn() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the method returns `undefined`', function test( t ) { - var arr; - var out; - - arr = new BooleanArray( [ true, false, false, true ] ); - out = arr.forEach( fcn ); - - t.strictEqual( out, void 0, 'returns expected value' ); - t.end(); - - function fcn( v ) { - if ( !isBoolean( v ) ) { - t.fail( 'should be a boolean' ); - } - } -}); - -tape( 'the method invokes a provided function for each element in an array', function test( t ) { - var indices; - var values; - var arrays; - var arr; - - indices = []; - values = []; - arrays = []; - - arr = new BooleanArray( [ true, false, false, true ] ); - arr.forEach( fcn ); - - t.deepEqual( values, [ true, false, false, true ], 'returns expected value' ); - t.deepEqual( indices, [ 0, 1, 2, 3 ], 'returns expected value' ); - t.strictEqual( arrays[ 0 ], arr, 'returns expected value' ); - t.strictEqual( arrays[ 1 ], arr, 'returns expected value' ); - t.strictEqual( arrays[ 2 ], arr, 'returns expected value' ); - t.strictEqual( arrays[ 3 ], arr, 'returns expected value' ); - - t.end(); - - function fcn( v, i, arr ) { - values.push( v ); - indices.push( i ); - arrays.push( arr ); - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var ctx; - var arr; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ true, false, false, true ] ); - arr.forEach( fcn, ctx ); - - t.strictEqual( ctx.count, 4, 'returns expected value' ); - - t.end(); - - function fcn() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); diff --git a/test/test.from.js b/test/test.from.js deleted file mode 100644 index dc3c118..0000000 --- a/test/test.from.js +++ /dev/null @@ -1,654 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 proxyquire = require( 'proxyquire' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is a `from` method for creating a boolean array from an array-like object or iterable', function test( t ) { - var arr; - - t.strictEqual( hasOwnProp( BooleanArray, 'from' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.from ), true, 'has method' ); - - arr = BooleanArray.from( [] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a constructor', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from.call( value, [] ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array constructor', function test( t ) { - var values; - var i; - - values = [ - {}, - null, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from.call( value, [] ); - }; - } -}); - -tape( 'the method throws an error if not provided an iterable or array-like object', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from( value ); - }; - } -}); - -tape( 'the method throws an error if not provided an iterable or array-like object (callback)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from( value, clbk ); - }; - } - - function clbk() { - return true; - } -}); - -tape( 'the method throws an error if not provided an iterable or array-like object (callback, thisArg)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from( value, clbk, {} ); - }; - } - - function clbk() { - return true; - } -}); - -tape( 'the method throws an error if provided a second argument which is not a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from( [], value ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not a function (thisArg)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from( [], value, {} ); - }; - } -}); - -tape( 'the method returns a boolean array', function test( t ) { - var arr; - var v; - - // Generic array: - arr = BooleanArray.from( [] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = BooleanArray.from( [ true, true, true, true ] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 4, 'returns expected value' ); - - // Generic array containing non-booleans: - arr = BooleanArray.from( [ 'beep' ] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 1, 'returns expected value' ); - - arr = BooleanArray.from( [ null, 4 ] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - arr = BooleanArray.from( [ true, {}, '' ] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 3, 'returns expected value' ); - - // Typed array: - arr = BooleanArray.from( new Uint8Array( 0 ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = BooleanArray.from( new Uint8Array( [ 1, 1 ] ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - // Boolean typed array: - arr = BooleanArray.from( new BooleanArray( 0 ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = BooleanArray.from( new BooleanArray( [ true, false ] ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method returns a boolean array (iterable)', function test( t ) { - var BooleanArray; - var iter; - var arr; - var v; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - iter = { - 'next': next, - 'i': 0, - 'N': 4 - }; - arr = BooleanArray.from( createIterable( iter ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, iter.N, 'returns expected value' ); - - t.end(); - - function hasSupport() { - return true; - } - - function createIterable( iterator ) { - var it = {}; - it[ '__SYMBOL_ITERATOR__' ] = iterable; - return it; - - function iterable() { - return iterator; - } - } - - function next() { - iter.i += 1; - if ( iter.i <= iter.N ) { - return { - 'value': true - }; - } - return { - 'done': true - }; - } -}); - -tape( 'the method supports providing a "map" function which is invoked for each source element', function test( t ) { - var arr; - var v; - - // Generic array: - arr = BooleanArray.from( [], clbk1 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = BooleanArray.from( [ true, true, true, true ], clbk1 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 4, 'returns expected value' ); - - // Generic array containing non-booleans: - arr = BooleanArray.from( [ 'beep' ], clbk2 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 1, 'returns expected value' ); - - arr = BooleanArray.from( [ null ], clbk2 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 1, 'returns expected value' ); - - arr = BooleanArray.from( [ [], {} ], clbk1 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - arr = BooleanArray.from( [ 4, 5 ], clbk1 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - // Typed array: - arr = BooleanArray.from( new Uint8Array( 0 ), clbk1 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = BooleanArray.from( new Uint8Array( [ 1, 1 ] ), clbk1 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - // Boolean typed array: - arr = BooleanArray.from( new BooleanArray( 0 ), clbk2 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = BooleanArray.from( new BooleanArray( [ true, true ] ), clbk2 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - t.end(); - - function clbk1( v ) { - return v; - } - - function clbk2() { - return true; - } -}); - -tape( 'the method supports providing a "map" function which is invoked for each iterated value', function test( t ) { - var BooleanArray; - var iter; - var arr; - var v; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - iter = { - 'next': next, - 'i': 0, - 'N': 4 - }; - arr = BooleanArray.from( createIterable( iter ), clbk ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, iter.N, 'returns expected value' ); - - t.end(); - - function hasSupport() { - return true; - } - - function createIterable( iterator ) { - var it = {}; - it[ '__SYMBOL_ITERATOR__' ] = iterable; - return it; - - function iterable() { - return iterator; - } - } - - function next() { - iter.i += 1; - if ( iter.i <= iter.N ) { - return { - 'value': true - }; - } - return { - 'done': true - }; - } - - function clbk( v ) { - return !v; - } -}); - -tape( 'the method supports providing a `this` context for a provided map function', function test( t ) { - var arr; - var ctx; - - ctx = { - 'count': 0 - }; - arr = BooleanArray.from( [ true, true, true, true ], clbk1, ctx ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.strictEqual( ctx.count, 4, 'returns expected value' ); - - t.end(); - - function clbk1( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return v; - } -}); - -tape( 'the method supports providing a `this` context for a provided map function (iterable)', function test( t ) { - var BooleanArray; - var iter; - var ctx; - var arr; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - iter = { - 'next': next, - 'i': 0, - 'N': 4 - }; - ctx = { - 'count': 0 - }; - - arr = BooleanArray.from( createIterable( iter ), clbk, ctx ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.strictEqual( ctx.count, 4, 'returns expected value' ); - - t.end(); - - function hasSupport() { - return true; - } - - function createIterable( iterator ) { - var it = {}; - it[ '__SYMBOL_ITERATOR__' ] = iterable; - return it; - - function iterable() { - return iterator; - } - } - - function next() { - iter.i += 1; - if ( iter.i <= iter.N ) { - return { - 'value': true - }; - } - return { - 'done': true - }; - } - - function clbk( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return v; - } -}); - -tape( 'the method throws an error if provided a non-iterable object (non-ES2015+)', function test( t ) { - var BooleanArray; - var values; - var i; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport - }); - - values = [ - {}, - { - '0': 1, - '1': 2, - '2': 3 - } - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from( value ); - }; - } - - function hasSupport() { - return false; - } -}); - -tape( 'the method throws an error if provided a non-iterable object (ES2015+)', function test( t ) { - var BooleanArray; - var values; - var i; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - values = [ - {}, - { - '0': 1, - '1': 2, - '2': 3 - }, - { - '__SYMBOL_ITERATOR__': null - }, - { - '__SYMBOL_ITERATOR__': 'beep' - }, - { - '__SYMBOL_ITERATOR__': nonIterable1 - }, - { - '__SYMBOL_ITERATOR__': nonIterable2 - } - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.from( value ); - }; - } - - function hasSupport() { - return true; - } - - function nonIterable1() { - return null; - } - - function nonIterable2() { - return {}; - } -}); diff --git a/test/test.get.js b/test/test.get.js deleted file mode 100644 index fe45a39..0000000 --- a/test/test.get.js +++ /dev/null @@ -1,135 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Boolean = require( '@stdlib/boolean-ctor' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `get` method for returning an array element', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'get' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.get ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.get.call( value, 0 ); - }; - } -}); - -tape( 'the method throws an error if provided an index argument which is not a nonnegative integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - -5, - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.get( value ); - }; - } -}); - -tape( 'the method returns `undefined` if provided an index which exceeds array dimensions', function test( t ) { - var arr; - var v; - var i; - - arr = new BooleanArray( 10 ); - for ( i = 0; i < arr.length; i++ ) { - v = arr.get( arr.length+i ); - t.strictEqual( v, void 0, 'returns expected value for index '+(arr.length+i) ); - } - t.end(); -}); - -tape( 'the method returns an array element', function test( t ) { - var arr; - var v; - var i; - - arr = []; - for ( i = 0; i < 10; i++ ) { - arr.push( i%2 ); - } - arr = new BooleanArray( arr ); - - for ( i = 0; i < arr.length; i++ ) { - v = arr.get( i ); - t.strictEqual( v, Boolean( i%2 ), 'returns expected value for index '+i ); - } - t.end(); -}); diff --git a/test/test.includes.js b/test/test.includes.js deleted file mode 100644 index 09d682a..0000000 --- a/test/test.includes.js +++ /dev/null @@ -1,221 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is an `includes` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'includes' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.includes ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.includes.call( value, true ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a boolean value', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.includes( value ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.includes( true, value ); - }; - } -}); - -tape( 'the method returns `false` if operating on an empty boolean array', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray(); - bool = arr.includes( true ); - - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns `false` if a boolean value is not found', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( 10 ); - bool = arr.includes( true ); - - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns `true` if an array contains a specified boolean value', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ true, false, false, true] ); - bool = arr.includes( false ); - - t.strictEqual( bool, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns `false` if provided a second argument which exceeds the input array length', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( 10 ); - bool = arr.includes( true, 20 ); - - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the method supports specifying a starting search index', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ true, false, true, true, true ] ); - - bool = arr.includes( true, 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = arr.includes( false, 1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = arr.includes( false, 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the method supports specifying a starting search index (negative)', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ true, false, true, true, true ] ); - - bool = arr.includes( true, -5 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = arr.includes( false, -2 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'when provided a starting index which resolves to an index which is less than zero, the method searches from the first array element', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ true, false, true, true, true ] ); - - bool = arr.includes( true, -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = arr.includes( false, -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.index_of.js b/test/test.index_of.js deleted file mode 100644 index 0360771..0000000 --- a/test/test.index_of.js +++ /dev/null @@ -1,221 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is an `indexOf` method for returning an array element', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'indexOf' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.indexOf ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.indexOf.call( value, true ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a boolean value', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.indexOf( value ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.indexOf( true, value ); - }; - } -}); - -tape( 'the method returns `-1` if operating on an empty boolean array', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray(); - idx = arr.indexOf( true ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns `-1` if a boolean value is not found', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( 10 ); - idx = arr.indexOf( true ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns the index of the first match if a boolean value is found', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true ] ); - idx = arr.indexOf( false ); - - t.strictEqual( idx, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns `-1` if provided a second argument which exceeds the input array length', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( 10 ); - idx = arr.indexOf( false, 20 ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method supports specifying a starting search index', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true ] ); - - idx = arr.indexOf( false, 0 ); - t.strictEqual( idx, 1, 'returns expected value' ); - - idx = arr.indexOf( true, 2 ); - t.strictEqual( idx, 3, 'returns expected value' ); - - idx = arr.indexOf( false, 3 ); - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method supports specifying a starting search index (negative)', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true ] ); - - idx = arr.indexOf( false, -5 ); - t.strictEqual( idx, 1, 'returns expected value' ); - - idx = arr.indexOf( false, -2 ); - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'when provided a starting index which resolves to an index which is less than zero, the method searches from the first array element', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true ] ); - - idx = arr.indexOf( false, -10 ); - t.strictEqual( idx, 1, 'returns expected value' ); - - idx = arr.indexOf( true, -10 ); - t.strictEqual( idx, 0, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.join.js b/test/test.join.js deleted file mode 100644 index bcc39a0..0000000 --- a/test/test.join.js +++ /dev/null @@ -1,162 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `join` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'join' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.join ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.join.call( value ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `separator` argument which is not a string', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.join( value ); - }; - } -}); - -tape( 'the method returns an empty string if invoked on an empty array', function test( t ) { - var str; - var arr; - - arr = new BooleanArray(); - str = arr.join(); - - t.strictEqual( str, '', 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns a string representation of a boolean array with elements separated by a separator', function test( t ) { - var expected; - var str; - var arr; - - arr = new BooleanArray( [ true, false, false, true ] ); - expected = 'true@false@false@true'; - - str = arr.join( '@' ); - - t.strictEqual( str, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns a string representation of a boolean array with elements separated by a separator (single element)', function test( t ) { - var expected; - var str; - var arr; - - arr = new BooleanArray( [ true ] ); - expected = 'true'; - - str = arr.join(); - - t.strictEqual( str, expected, 'returns expected value' ); - - arr = new BooleanArray( [ false ] ); - expected = 'false'; - - str = arr.join( '@' ); - - t.strictEqual( str, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if the method is invoked without a separator argument, the method returns a string representation of a boolean array with elements separated by a comma', function test( t ) { - var expected; - var str; - var arr; - - arr = new BooleanArray( [ true, false, false, true ] ); - expected = 'true,false,false,true'; - - str = arr.join(); - - t.strictEqual( str, expected, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 6db4ae0..0000000 --- a/test/test.js +++ /dev/null @@ -1,660 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is a constructor', function test( t ) { - var arr = new BooleanArray( 0 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor( 0 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns a boolean array (no argument)', function test( t ) { - var arr = new BooleanArray(); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns a boolean array (no argument, no new)', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor(); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns a boolean array (length)', function test( t ) { - var arr = new BooleanArray( 10 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns a boolean array (length, no new)', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor( 10 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns a boolean array (array)', function test( t ) { - var arr = new BooleanArray( [] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns a boolean array (array, no new)', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor( [] ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns a boolean array (typed array)', function test( t ) { - var arr = new BooleanArray( new Uint8Array( 0 ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns a boolean array (typed array, no new)', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor( new Uint8Array( 0 ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns a boolean array (iterable)', function test( t ) { - var BooleanArray; - var arr; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - arr = new BooleanArray( createIterable() ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); - - function hasSupport() { - return true; - } - - function createIterable() { - var it = {}; - it[ '__SYMBOL_ITERATOR__' ] = iterable; - return it; - - function iterable() { - return { - 'next': next - }; - } - - function next() { - return { - 'done': true - }; - } - } -}); - -tape( 'the constructor returns a boolean array (iterable, no new)', function test( t ) { - var ctor; - var arr; - - ctor = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - arr = ctor( createIterable() ); - t.strictEqual( arr instanceof ctor, true, 'returns expected value' ); - - t.end(); - - function hasSupport() { - return true; - } - - function createIterable() { - var it = {}; - it[ '__SYMBOL_ITERATOR__' ] = iterable; - return it; - - function iterable() { - return { - 'next': next - }; - } - - function next() { - return { - 'done': true - }; - } - } -}); - -tape( 'the constructor returns a boolean array (ArrayBuffer)', function test( t ) { - var arr = new BooleanArray( new ArrayBuffer( 0 ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns a boolean array (ArrayBuffer, no new)', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor( new ArrayBuffer( 0 ) ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns a boolean array (ArrayBuffer, byte offset)', function test( t ) { - var arr = new BooleanArray( new ArrayBuffer( 8 ), 8 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns a boolean array (ArrayBuffer, byte offset, no new)', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor( new ArrayBuffer( 8 ), 8 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns a boolean array (ArrayBuffer, byte offset, length)', function test( t ) { - var arr = new BooleanArray( new ArrayBuffer( 8 ), 8, 0 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns a boolean array (ArrayBuffer, byte offset, length, no new)', function test( t ) { - var ctor; - var arr; - - ctor = BooleanArray; - - arr = ctor( new ArrayBuffer( 8 ), 8, 0 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'attached to the constructor is a property returning the number of bytes per array element', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( BooleanArray.BYTES_PER_ELEMENT, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'attached to the constructor is a property returning the constructor name', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray, 'name' ), true, 'has property' ); - t.strictEqual( BooleanArray.name, 'BooleanArray', 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns an instance having a `BYTES_PER_ELEMENT` property returning the number of bytes per array element', function test( t ) { - var arr; - - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( BooleanArray.prototype.BYTES_PER_ELEMENT, 1, 'returns expected value' ); - - arr = new BooleanArray( 0 ); - t.strictEqual( arr.BYTES_PER_ELEMENT, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns an instance having a `buffer` property for returning the underlying memory (i.e., ArrayBuffer)', function test( t ) { - var arr; - var buf; - - arr = new BooleanArray( 0 ); - buf = arr.buffer; - t.strictEqual( isArrayBuffer( buf ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor returns an instance having a `byteLength` property for returning the number of bytes belonging to the array view', function test( t ) { - var arr; - var v; - - arr = new BooleanArray( 0 ); - v = arr.byteLength; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = new BooleanArray( new ArrayBuffer( 64 ), 8 ); - v = arr.byteLength; - t.strictEqual( v, 56, 'returns expected value' ); - - arr = new BooleanArray( new ArrayBuffer( 64 ), 64 ); - v = arr.byteLength; - t.strictEqual( v, 0, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns an instance having a `byteOffset` property for returning the byte offset pointing to the first array element in the underlying memory', function test( t ) { - var arr; - var v; - - arr = new BooleanArray( 0 ); - v = arr.byteOffset; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = new BooleanArray( new ArrayBuffer( 64 ), 32 ); - v = arr.byteOffset; - t.strictEqual( v, 32, 'returns expected value' ); - - arr = new BooleanArray( new ArrayBuffer( 64 ), 64 ); - v = arr.byteOffset; - t.strictEqual( v, 64, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns an instance having a `length` property for returning the number of array elements', function test( t ) { - var arr; - var v; - - // No arguments: - arr = new BooleanArray(); - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - // Explicit array length: - arr = new BooleanArray( 0 ); - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = new BooleanArray( 10 ); - v = arr.length; - t.strictEqual( v, 10, 'returns expected value' ); - - // Generic array: - arr = new BooleanArray( [] ); - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = new BooleanArray( [ true, false, true, false ] ); - v = arr.length; - t.strictEqual( v, 4, 'returns expected value' ); - - // Typed array: - arr = new BooleanArray( new Uint8Array( 0 ) ); - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = new BooleanArray( new Uint8Array( [ 1, 1 ] ) ); - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - // Boolean typed array: - arr = new BooleanArray( new BooleanArray( 0 ) ); - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = new BooleanArray( new BooleanArray( [ true, true ] ) ); - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - // ArrayBuffer: - arr = new BooleanArray( new ArrayBuffer( 64 ), 32 ); - v = arr.length; - t.strictEqual( v, 32, 'returns expected value' ); - - arr = new BooleanArray( new ArrayBuffer( 64 ), 64 ); - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - arr = new BooleanArray( new ArrayBuffer( 64 ), 32, 2 ); - v = arr.length; - t.strictEqual( v, 2, 'returns expected value' ); - - t.end(); -}); - -tape( 'the constructor returns an instance having a `length` property for returning the number of array elements (iterable)', function test( t ) { - var BooleanArray; - var iter; - var arr; - var v; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - iter = { - 'next': next, - 'i': 0, - 'N': 4 - }; - arr = new BooleanArray( createIterable( iter ) ); - v = arr.length; - t.strictEqual( v, iter.N, 'returns expected value' ); - - t.end(); - - function hasSupport() { - return true; - } - - function createIterable( iterator ) { - var it = {}; - it[ '__SYMBOL_ITERATOR__' ] = iterable; - return it; - - function iterable() { - return iterator; - } - } - - function next() { - iter.i += 1; - if ( iter.i <= iter.N ) { - return { - 'value': true - }; - } - return { - 'done': true - }; - } -}); - -tape( 'the constructor throws an error if provided a non-iterable object (non-ES2015+)', function test( t ) { - var BooleanArray; - var values; - var i; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport - }); - - values = [ - {}, - { - '0': 1, - '1': 2, - '2': 3 - } - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return new BooleanArray( value ); - }; - } - - function hasSupport() { - return false; - } -}); - -tape( 'the constructor throws an error if provided a non-iterable object (ES2015+)', function test( t ) { - var BooleanArray; - var values; - var i; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/assert-has-iterator-symbol-support': hasSupport, - '@stdlib/symbol-iterator': '__SYMBOL_ITERATOR__' - }); - - values = [ - {}, - { - '0': 1, - '1': 2, - '2': 3 - }, - { - '__SYMBOL_ITERATOR__': null - }, - { - '__SYMBOL_ITERATOR__': 'beep' - }, - { - '__SYMBOL_ITERATOR__': nonIterable1 - }, - { - '__SYMBOL_ITERATOR__': nonIterable2 - } - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return new BooleanArray( value ); - }; - } - - function hasSupport() { - return true; - } - - function nonIterable1() { - return null; - } - - function nonIterable2() { - return {}; - } -}); - -tape( 'the constructor throws an error if not provided a length, iterable, array-like object, or ArrayBuffer', function test( t ) { - var values; - var i; - - values = [ - '5', - 3.14, - -1, - NaN, - true, - false, - null, - void 0, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return new BooleanArray( value ); - }; - } -}); - -tape( 'the constructor throws an error if provided more than one argument and the first argument is not an ArrayBuffer', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return new BooleanArray( value, 0 ); - }; - } -}); - -tape( 'the constructor throws an error if provided a byte offset argument which is not a nonnegative integer', function test( t ) { - var values; - var i; - - values = [ - '5', - -1, - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return new BooleanArray( new ArrayBuffer( 64 ), value ); - }; - } -}); - -tape( 'the constructor throws an error if provided a length argument which is not a nonnegative integer (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - -1, - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return new BooleanArray( new ArrayBuffer( 64 ), 0, value ); - }; - } -}); - -tape( 'the constructor throws an error if provided insufficient memory to accommodate byte offset and length arguments', function test( t ) { - var values; - var i; - - values = [ - 8, - 16, - 24, - 32 - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return new BooleanArray( new ArrayBuffer( 100 ), value, 1e3 ); - }; - } -}); diff --git a/test/test.keys.js b/test/test.keys.js deleted file mode 100644 index 572a8b5..0000000 --- a/test/test.keys.js +++ /dev/null @@ -1,261 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `keys` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'keys' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.keys ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.keys.call( value ); - }; - } -}); - -tape( 'the method returns an iterator protocol-compliant object', function test( t ) { - var expected; - var arr; - var it; - var i; - var r; - var e; - - arr = new BooleanArray( [ true, false ] ); - expected = [ - { - 'value': 0, - 'done': false - }, - { - 'value': 1, - 'done': false - }, - { - 'done': true - } - ]; - it = arr.keys(); - - t.strictEqual( typeof it, 'object', 'returns expected value' ); - t.strictEqual( typeof it.next, 'function', 'has next method' ); - - for ( i = 0; i < expected.length; i++ ) { - r = it.next(); - e = expected[ i ]; - if ( e.value === void 0 ) { - t.deepEqual( r, e, 'returns expected value' ); - } else { - t.strictEqual( r.value, e.value, 'returns expected value' ); - t.strictEqual( r.done, e.done, 'returns expected value' ); - } - } - - t.end(); -}); - -tape( 'the method returns an iterator which does not iterate over empty arrays', function test( t ) { - var expected; - var arr; - var it; - var i; - var v; - - arr = new BooleanArray( [] ); - expected = [ - { - 'done': true - }, - { - 'done': true - }, - { - 'done': true - } - ]; - it = arr.keys(); - - t.strictEqual( typeof it, 'object', 'returns expected value' ); - t.strictEqual( typeof it.next, 'function', 'has next method' ); - - for ( i = 0; i < expected.length; i++ ) { - v = it.next(); - t.deepEqual( v, expected[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (no argument)', function test( t ) { - var arr; - var it; - var v; - - arr = new BooleanArray( [ true, false, true ] ); - it = arr.keys(); - - v = it.next(); - t.strictEqual( v.value, 0, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, 1, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.return(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (argument)', function test( t ) { - var arr; - var it; - var v; - - arr = new BooleanArray( [ true, false, true ] ); - it = arr.keys(); - - v = it.next(); - t.strictEqual( v.value, 0, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, 1, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.return( 'beep' ); - t.strictEqual( v.value, 'beep', 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if an environment supports `Symbol.iterator`, the method returns an iterable', function test( t ) { - var BooleanArray; - var arr; - var buf; - var it1; - var it2; - var v1; - var v2; - var i; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/symbol-iterator': '__ITERATOR_SYMBOL__' - }); - - buf = [ 1, 0, 0, 1 ]; - arr = new BooleanArray( buf ); - - it1 = arr.keys(); - t.strictEqual( typeof it1[ '__ITERATOR_SYMBOL__' ], 'function', 'has method' ); - t.strictEqual( it1[ '__ITERATOR_SYMBOL__' ].length, 0, 'has zero arity' ); - - it2 = it1[ '__ITERATOR_SYMBOL__' ](); - t.strictEqual( typeof it2, 'object', 'returns expected value' ); - t.strictEqual( typeof it2.next, 'function', 'has `next` method' ); - t.strictEqual( typeof it2.return, 'function', 'has `return` method' ); - - for ( i = 0; i < arr.length; i++ ) { - v1 = it1.next().value; - v2 = it2.next().value; - t.strictEqual( v1, v2, 'returns expected value' ); - } - t.end(); -}); - -tape( 'if an environment does not support `Symbol.iterator`, the method does not return an "iterable"', function test( t ) { - var BooleanArray; - var arr; - var buf; - var it; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/symbol-iterator': false - }); - - buf = [ 1, 0, 0, 1 ]; - arr = new BooleanArray( buf ); - - it = arr.keys(); - t.strictEqual( it[ ITERATOR_SYMBOL ], void 0, 'does not have property' ); - - t.end(); -}); diff --git a/test/test.last_index_of.js b/test/test.last_index_of.js deleted file mode 100644 index 32e0b1d..0000000 --- a/test/test.last_index_of.js +++ /dev/null @@ -1,210 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `lastIndexOf` method for returning an array element', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'lastIndexOf' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.lastIndexOf ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.lastIndexOf.call( value, true ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a boolean value', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.lastIndexOf( value ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.lastIndexOf( true, value ); - }; - } -}); - -tape( 'the method returns `-1` if operating on an empty boolean array', function test( t ) { - var arr; - var idx; - - arr = new BooleanArray(); - idx = arr.lastIndexOf( true ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns `-1` if a boolean value is not found', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( 10 ); - idx = arr.lastIndexOf( true ); - - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns the index of the first match when searching from the end of the array if a search element is found', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true ] ); - idx = arr.lastIndexOf( false ); - - t.strictEqual( idx, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the method supports specifying a starting search index', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true ] ); - - idx = arr.lastIndexOf( true, 4 ); - t.strictEqual( idx, 4, 'returns expected value' ); - - idx = arr.lastIndexOf( false, 2 ); - t.strictEqual( idx, 2, 'returns expected value' ); - - idx = arr.lastIndexOf( false, 0 ); - t.strictEqual( idx, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the method supports specifying a starting search index (negative)', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true ] ); - - idx = arr.lastIndexOf( true, -3 ); - t.strictEqual( idx, 0, 'returns expected value' ); - - idx = arr.lastIndexOf( false, -1 ); - t.strictEqual( idx, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'when the method is provided a starting index which resolves to an index which exceeds the maximum array index, the method searches from the last array element', function test( t ) { - var idx; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true ] ); - - idx = arr.lastIndexOf( true, 10 ); - t.strictEqual( idx, 4, 'returns expected value' ); - - idx = arr.lastIndexOf( false, 10 ); - t.strictEqual( idx, 2, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.map.js b/test/test.map.js deleted file mode 100644 index b4ed8de..0000000 --- a/test/test.map.js +++ /dev/null @@ -1,164 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var identity = require( '@stdlib/utils-identity-function' ); -var reinterpretBool = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `map` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'map' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.map ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.map.call( value, identity ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.map( value ); - }; - } -}); - -tape( 'the method returns an empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.map( identity ); - - t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( out.length, 0, 'returns expected value' ); - t.notEqual( out, arr, 'returns a new instance' ); - t.end(); -}); - -tape( 'the method returns a new boolean array containing elements which are the result of a provided callback function', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - expected = new Uint8Array( [ 0, 1, 1, 0, 0, 1 ] ); - actual = arr.map( invert ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.notEqual( actual, arr, 'returns a new instance' ); - t.deepEqual( reinterpretBool( actual, 0 ), expected, 'returns expected value' ); - t.end(); - - function invert( v ) { - return !v; - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var expected; - var actual; - var arr; - var ctx; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - expected = new Uint8Array( [ 0, 1, 1, 0, 0, 1 ] ); - ctx = { - 'count': 0 - }; - actual = arr.map( invert, ctx ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBool( actual, 0 ), expected, 'returns expected value' ); - t.strictEqual( ctx.count, 15, 'returns expected value' ); - t.end(); - - function invert( v, i ) { - this.count += i; // eslint-disable-line no-invalid-this - return !v; - } -}); diff --git a/test/test.of.js b/test/test.of.js deleted file mode 100644 index 3a15165..0000000 --- a/test/test.of.js +++ /dev/null @@ -1,130 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `of` method for creating a boolean array from a variable number of arguments', function test( t ) { - var arr; - - t.strictEqual( hasOwnProp( BooleanArray, 'of' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.of ), true, 'has method' ); - - arr = BooleanArray.of(); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a constructor', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.of.call( value, true, true ); - }; - } -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array constructor', function test( t ) { - var values; - var i; - - values = [ - {}, - null, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return BooleanArray.of.call( value, true, true ); - }; - } -}); - -tape( 'the method returns a boolean array', function test( t ) { - var arr; - var v; - - // No arguments: - arr = BooleanArray.of(); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 0, 'returns expected value' ); - - // Boolean arguments: - arr = BooleanArray.of( true, false, false, true ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 4, 'returns expected value' ); - - // Non-boolean arguments: - arr = BooleanArray.of( 1, {}, 0, null, 'beep' ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 5, 'returns expected value' ); - - // Mixed arguments: - arr = BooleanArray.of( true, 1, false, 0 ); - t.strictEqual( arr instanceof BooleanArray, true, 'returns expected value' ); - - v = arr.length; - t.strictEqual( v, 4, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.reduce.js b/test/test.reduce.js deleted file mode 100644 index 4f50735..0000000 --- a/test/test.reduce.js +++ /dev/null @@ -1,197 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `reduce` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'reduce' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.reduce ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.reduce.call( value, reducer ); - }; - } - - function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.reduce( value ); - }; - } -}); - -tape( 'the method throws an error if not provided an initial value when operating on an empty boolean array', function test( t ) { - var arr; - - arr = new BooleanArray( 0 ); - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - arr.reduce( reducer ); - } - - function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; - } -}); - -tape( 'the method uses the first element of the array as the initial value when an initial value is not provided', function test( t ) { - var valueArray; - var accArray; - var expected; - var actual; - var arr; - var ind; - - arr = new BooleanArray( [ true, false, true, false ] ); - accArray = [ true, false, false ]; - valueArray = [ false, true, false ]; - expected = false; - actual = arr.reduce( reducer ); - - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); - - function reducer( acc, value, index ) { - ind = index-1; - t.strictEqual( acc, accArray[ ind ], 'returns expected value' ); - t.strictEqual( value, valueArray[ ind ], 'returns expected value' ); - return ( acc && value ); - } -}); - -tape( 'the method supports providing an initial value as the second argument', function test( t ) { - var valueArray; - var accArray; - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, false, true ] ); - accArray = [ 0, 1, 1, 1 ]; - valueArray = [ true, false, false, true ]; - expected = 2; - actual = arr.reduce( reducer, 0 ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); - - function reducer( acc, value, index ) { - t.strictEqual( acc, accArray[ index ], 'returns expected value' ); - t.strictEqual( value, valueArray[ index ], 'returns expected value' ); - if ( value ) { - return acc + 1; - } - return acc; - } -}); - -tape( 'the method returns the accumulated result', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, true ] ); - expected = false; - actual = arr.reduce( reducer ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); - - function reducer( acc, value ) { - return ( acc && value ); - } -}); diff --git a/test/test.reduce_right.js b/test/test.reduce_right.js deleted file mode 100644 index 43b200e..0000000 --- a/test/test.reduce_right.js +++ /dev/null @@ -1,200 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `reduceRight` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'reduceRight' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.reduceRight ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.reduceRight.call( value, reducer ); - }; - } - - function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.reduceRight( value ); - }; - } -}); - -tape( 'the method throws an error if not provided an initial value when operating on an empty boolean array', function test( t ) { - var arr; - - arr = new BooleanArray( 0 ); - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - arr.reduceRight( reducer ); - } - - function reducer( acc, value ) { - if ( value ) { - return acc + 1; - } - return acc; - } -}); - -tape( 'the method uses the last element of the array as the initial value when an initial value is not provided', function test( t ) { - var valueArray; - var accArray; - var expected; - var actual; - var arr; - var len; - - arr = new BooleanArray( [ true, false, true, false ] ); - len = arr.length; - accArray = [ false, false, false ]; - valueArray = [ true, false, true ]; - expected = false; - actual = arr.reduceRight( reducer ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); - - function reducer( acc, value, index ) { - var ind = (len-index-2); - t.strictEqual( acc, accArray[ ind ], 'returns expected value' ); - t.strictEqual( value, valueArray[ ind ], 'returns expected value' ); - return ( acc && value ); - } -}); - -tape( 'the method supports providing an initial value as the second argument', function test( t ) { - var valueArray; - var accArray; - var expected; - var actual; - var arr; - var len; - - arr = new BooleanArray( [ true, false, false, true ] ); - len = arr.length; - accArray = [ 0, 1, 1, 1 ]; - valueArray = [ true, false, false, true ]; - expected = 2; - actual = arr.reduceRight( reducer, 0 ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); - - function reducer( acc, value, index ) { - var ind = (len-index-1); - t.strictEqual( acc, accArray[ ind ], 'returns expected value' ); - t.strictEqual( value, valueArray[ ind ], 'returns expected value' ); - if ( value ) { - return acc + 1; - } - return acc; - } -}); - -tape( 'the method returns the accumulated result', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, true ] ); - expected = false; - actual = arr.reduceRight( reducer ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); - - function reducer( acc, value ) { - return ( acc && value ); - } -}); diff --git a/test/test.reverse.js b/test/test.reverse.js deleted file mode 100644 index ed1792e..0000000 --- a/test/test.reverse.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `reverse` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'reverse' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.reverse ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.reverse.call( value ); - }; - } -}); - -tape( 'the method returns an empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.reverse(); - - t.strictEqual( out.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the method reverses elements of a boolean array in-place', function test( t ) { - var expected; - var arr; - var out; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - expected = new Uint8Array( [ 0, 1, 1, 0, 0, 1 ] ); - out = arr.reverse(); - - t.strictEqual( instanceOf( arr, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( out, arr, 'returns expected value' ); - t.strictEqual( arr.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method does not change the array length', function test( t ) { - var arr; - var out; - - arr = new BooleanArray( 10 ); - out = arr.reverse(); - - t.strictEqual( out.length, 10, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.set.js b/test/test.set.js deleted file mode 100644 index 924fa3d..0000000 --- a/test/test.set.js +++ /dev/null @@ -1,387 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `set` method for setting one or more array elements', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'set' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.set ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.set.call( value, 0 ); - }; - } -}); - -tape( 'the method throws an error if provided an index argument which is not a nonnegative integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - -5, - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.set( true, value ); - }; - } -}); - -tape( 'the method throws an error if provided an index argument which is out-of-bounds (non-array)', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - arr.length, - arr.length + 1, - arr.length + 2, - arr.length + 3 - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.set( true, value ); - }; - } -}); - -tape( 'the method throws an error if provided an index argument which is out-of-bounds (array-like object)', function test( t ) { - var values; - var arr1; - var arr2; - var i; - - arr1 = new BooleanArray( 10 ); - arr2 = []; - for ( i = 0; i < arr1.length; i++ ) { - arr2.push( true ); - } - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr1.set( arr2, value ); - }; - } -}); - -tape( 'the method sets an array element (non-array)', function test( t ) { - var arr; - var v; - var i; - - arr = new BooleanArray( 10 ); - - v = arr.get( 0 ); - t.strictEqual( v, false, 'returns expected value' ); - - // No index argument: - arr.set( true ); - - v = arr.get( 0 ); - t.strictEqual( v, true, 'returns expected value' ); - - arr.set( false ); - - // Index argument: - for ( i = 0; i < arr.length; i++ ) { - v = arr.get( i ); - t.strictEqual( v, false, 'returns expected value' ); - - arr.set( true, i ); - v = arr.get( i ); - t.strictEqual( v, true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the method sets an array element (array-like object)', function test( t ) { - var arr; - var v; - var i; - - arr = new BooleanArray( 10 ); - - v = arr.get( 0 ); - t.strictEqual( v, false, 'returns expected value' ); - - // No index argument: - arr.set( [ true ] ); - - v = arr.get( 0 ); - t.strictEqual( v, true, 'returns expected value' ); - - arr.set( [ false ] ); - - // Index argument: - for ( i = 0; i < arr.length; i++ ) { - v = arr.get( i ); - t.strictEqual( v, false, 'returns expected value' ); - - arr.set( [ true ], i ); - - v = arr.get( i ); - t.strictEqual( v, true, 'returns expected value' ); - } - - // Multiple values, no index argument: - arr.set( [ true, true ] ); - - v = arr.get( 0 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 1 ); - t.strictEqual( v, true, 'returns expected value' ); - - // Multiple values, index argument: - arr.set( [ true, true ], 2 ); - - v = arr.get( 2 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 3 ); - t.strictEqual( v, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method sets an array element (typed array; shared buffer)', function test( t ) { - var byteOffset; - var arr; - var src; - var buf; - var ab; - var v; - var i; - - byteOffset = 112; - - ab = new ArrayBuffer( 240 ); - arr = new BooleanArray( ab, byteOffset, 10 ); - - // Overlapping (requires copy), multiple values, no index argument: - buf = [ true, true ]; - src = new Uint8Array( ab, byteOffset-(1*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src[ i ] = buf[ i ]; - } - arr.set( src ); - - v = arr.get( 0 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 1 ); - t.strictEqual( v, true, 'returns expected value' ); - - // Overlapping (requires copy), multiple values, index argument: - buf = [ true, true ]; - src = new Uint8Array( ab, byteOffset+(1*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src[ i ] = buf[ i ]; - } - arr.set( src, 2 ); - - v = arr.get( 2 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 3 ); - t.strictEqual( v, true, 'returns expected value' ); - - // Overlapping (no copy), multiple values, no index argument: - buf = [ true, true ]; - src = new Uint8Array( ab, byteOffset+(1*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src[ i ] = buf[ i ]; - } - arr.set( src ); - - v = arr.get( 0 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 1 ); - t.strictEqual( v, true, 'returns expected value' ); - - // Overlapping (no copy), multiple values, index argument: - buf = [ true, true ]; - src = new Uint8Array( ab, byteOffset+(3*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src[ i ] = buf[ i ]; - } - arr.set( src, 2 ); - - v = arr.get( 2 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 3 ); - t.strictEqual( v, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the method sets an array element (boolean array; shared buffer)', function test( t ) { - var byteOffset; - var arr; - var src; - var buf; - var ab; - var v; - var i; - - byteOffset = 112; - - ab = new ArrayBuffer( 240 ); - arr = new BooleanArray( ab, byteOffset, 10 ); - - // Overlapping (requires copy), multiple values, no index argument: - buf = [ true, true ]; - src = new BooleanArray( ab, byteOffset-(1*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src.set( buf[ i ], i ); - } - arr.set( src ); - - v = arr.get( 0 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 1 ); - t.strictEqual( v, true, 'returns expected value' ); - - // Overlapping (requires copy), multiple values, index argument: - buf = [ true, true ]; - src = new BooleanArray( ab, byteOffset+(1*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src.set( buf[ i ], i ); - } - arr.set( src, 2 ); - - v = arr.get( 2 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 3 ); - t.strictEqual( v, true, 'returns expected value' ); - - // Overlapping (no copy), multiple values, no index argument: - buf = [ true, true ]; - src = new BooleanArray( ab, byteOffset+(1*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src.set( buf[ i ], i ); - } - arr.set( src ); - - v = arr.get( 0 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 1 ); - t.strictEqual( v, true, 'returns expected value' ); - - // Overlapping (no copy), multiple values, index argument: - buf = [ true, true ]; - src = new BooleanArray( ab, byteOffset+(3*arr.BYTES_PER_ELEMENT), 2 ); - for ( i = 0; i < buf.length; i++ ) { - src.set( buf[ i ], i ); - } - arr.set( src, 2 ); - - v = arr.get( 2 ); - t.strictEqual( v, true, 'returns expected value' ); - - v = arr.get( 3 ); - t.strictEqual( v, true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.slice.js b/test/test.slice.js deleted file mode 100644 index 95b93f1..0000000 --- a/test/test.slice.js +++ /dev/null @@ -1,271 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `slice` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'slice' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.slice ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.slice.call( value ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.slice( value ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.slice( 0, value ); - }; - } -}); - -tape( 'the method returns an empty typed array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.slice(); - - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'if called without arguments, the method returns a typed array containing the same elements as the original array', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 1, 0, 1, 0, 1 ] ); - actual = arr.slice(); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.notEqual( actual, arr, 'returns a new instance' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if called with one argument, the method returns a typed array containing elements starting from a specified beginning index (inclusive)', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 0, 1, 0, 1 ] ); - actual = arr.slice( 1 ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if provided two arguments, the method returns a typed array containing elements starting from a specified beginning index (inclusive) and ending at a specified stop index (exclusive)', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 0, 1 ] ); - actual = arr.slice( 1, 3 ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 0, 1, 0, 1 ] ); - actual = arr.slice( 1, 30 ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method resolves negative indices relative to the last element', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - - expected = new Uint8Array( [ 1, 0 ] ); - actual = arr.slice( -3, -1 ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - - expected = new Uint8Array( [ 1, 0, 1 ] ); - actual = arr.slice( -30, -2 ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns an empty typed array if a resolved beginning index exceeds a resolved ending index', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [] ); - actual = arr.slice( 2, 0 ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns an empty typed array if a resolved beginning index exceeds the maximum array index', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false ] ); - expected = new Uint8Array( [] ); - actual = arr.slice( 5 ); - - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns an empty typed array if a resolved ending index is less than or equal to zero', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0 ] ); - expected = new Uint8Array( [] ); - - actual = arr.slice( 2, -8 ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length/2, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - - actual = arr.slice( 1, 0 ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length/2, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.some.js b/test/test.some.js deleted file mode 100644 index d8bafb8..0000000 --- a/test/test.some.js +++ /dev/null @@ -1,195 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `some` method for returning boolean indicating whether at least one element passes a test', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'some' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.some ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.some.call( value, predicate ); - }; - } - - function predicate( v ) { - return v === true; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.some( value ); - }; - } -}); - -tape( 'the method returns `false` if operating on an empty boolean array', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray(); - bool = arr.some( predicate ); - - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); - - function predicate() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the method returns `true` if at least one element passes a test', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ false, true, false, true ] ); - bool = arr.some( predicate ); - - t.strictEqual( bool, true, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return v === true; - } -}); - -tape( 'the method returns `false` if all elements fail a test', function test( t ) { - var bool; - var arr; - - arr = new BooleanArray( [ false, false, false, false ] ); - bool = arr.some( predicate ); - - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); - - function predicate( v ) { - return v === true; - } -}); - -tape( 'the method supports providing an execution context', function test( t ) { - var bool; - var ctx; - var arr; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ false, true, false, true ] ); - bool = arr.some( predicate, ctx ); - - t.strictEqual( bool, true, 'returns expected value' ); - t.strictEqual( ctx.count, 2, 'returns expected value' ); - - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return v === true; - } -}); - -tape( 'the method stops executing upon encountering the first element which passes a test', function test( t ) { - var bool; - var ctx; - var arr; - - ctx = { - 'count': 0 - }; - arr = new BooleanArray( [ false, true, true, false ] ); - bool = arr.some( predicate, ctx ); - - t.strictEqual( bool, true, 'returns expected value' ); - t.strictEqual( ctx.count, 2, 'returns expected value' ); - - t.end(); - - function predicate( v ) { - this.count += 1; // eslint-disable-line no-invalid-this - return v === true; - } -}); diff --git a/test/test.sort.js b/test/test.sort.js deleted file mode 100644 index 0fac28d..0000000 --- a/test/test.sort.js +++ /dev/null @@ -1,168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Comparison function. -* -* @private -* @param {boolean} a - first boolean value for comparison -* @param {boolean} b - second boolean value for comparison -* @returns {number} comparison result -*/ -function compareFcn( a, b ) { - if ( a === true ) { - if ( b === true ) { - return 0; - } - return 1; - } - if ( b === false ) { - return 0; - } - return -1; -} - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `sort` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'sort' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.sort ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.sort.call( value, compareFcn ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.sort( value ); - }; - } -}); - -tape( 'the method returns an empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.sort( compareFcn ); - - t.strictEqual( out.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the method sorts elements of a boolean array in-place', function test( t ) { - var expected; - var arr; - var out; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 0, 0, 1, 1, 1 ] ); - out = arr.sort( compareFcn ); - - t.strictEqual( instanceOf( arr, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( out, arr, 'returns expected value' ); - t.strictEqual( arr.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method does not change the array length', function test( t ) { - var arr; - var out; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - out = arr.sort( compareFcn ); - - t.strictEqual( out.length, arr.length, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.subarray.js b/test/test.subarray.js deleted file mode 100644 index 8135812..0000000 --- a/test/test.subarray.js +++ /dev/null @@ -1,272 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `subarray` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'subarray' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.subarray ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.subarray.call( value ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.subarray( value ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.subarray( 0, value ); - }; - } -}); - -tape( 'the method returns empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.subarray(); - - t.strictEqual( out.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'if called without arguments, the method returns a view containing the same elements as the original array', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 1, 0, 1, 0, 1 ] ); - actual = arr.subarray(); - - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if called with one argument, the method returns a view containing elements starting from a specified beginning index (inclusive)', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 0, 1, 0, 1 ] ); - actual = arr.subarray( 1 ); - - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'if provided two arguments, the method returns a view containing elements starting from a specified beginning index (inclusive) and ending at a specified stop index (exclusive)', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [ 0, 1 ] ); - actual = arr.subarray( 1, 3 ); - - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method resolves negative indices relative to the last element', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - - expected = new Uint8Array( [ 1, 0 ] ); - actual = arr.subarray( -3, -1 ); - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - - expected = new Uint8Array( [ 1, 0, 1 ] ); - actual = arr.subarray( -30, -2 ); - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns an empty view if a resolved beginning index exceeds a resolved ending index', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [] ); - actual = arr.subarray( 2, 0 ); - - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns an empty view if a resolved beginning index exceeds the maximum array index', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false ] ); - expected = new Uint8Array( [] ); - actual = arr.subarray( 5 ); - - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns an empty view if a resolved ending index is less than or equal to zero', function test( t ) { - var expected; - var actual; - var arr; - - arr = new BooleanArray( [ true, false, true, false, true ] ); - expected = new Uint8Array( [] ); - - actual = arr.subarray( 2, -8 ); - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - - actual = arr.subarray( 1, 0 ); - t.strictEqual( actual.buffer, arr.buffer, 'returns expected value' ); - t.strictEqual( instanceOf( actual, BooleanArray ), true, 'returns expected value' ); - t.strictEqual( actual.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( actual, 0 ), expected, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.to_locale_string.js b/test/test.to_locale_string.js deleted file mode 100644 index 6a89d42..0000000 --- a/test/test.to_locale_string.js +++ /dev/null @@ -1,187 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `toLocaleString` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'toLocaleString' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.toLocaleString ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toLocaleString.call( value ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a string or an array of strings', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray(); - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [ 1, 2, 3 ], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toLocaleString( value ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a string or an array of strings (options)', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray(); - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [ 1, 2, 3 ], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toLocaleString( value, {} ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not an object', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray(); - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - 'beep', - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toLocaleString( 'en-GB', value ); - }; - } -}); - -tape( 'the method returns an empty string if invoked on an empty array', function test( t ) { - var str; - var arr; - - arr = new BooleanArray(); - str = arr.toLocaleString(); - - t.strictEqual( str, '', 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns a string representation of a boolean array', function test( t ) { - var expected; - var str; - var arr; - - arr = new BooleanArray( [ true, false, true ] ); - expected = 'true,false,true'; - - str = arr.toLocaleString(); - - t.strictEqual( str, expected, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.to_reversed.js b/test/test.to_reversed.js deleted file mode 100644 index 01c81b8..0000000 --- a/test/test.to_reversed.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `toReversed` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'toReversed' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.toReversed ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toReversed.call( value ); - }; - } -}); - -tape( 'the method returns an empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.toReversed(); - - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns a new typed array containing elements in reverse order', function test( t ) { - var expected; - var arr; - var out; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - expected = new Uint8Array( [ 0, 1, 1, 0, 0, 1 ] ); - out = arr.toReversed(); - - t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' ); - t.notEqual( out, arr, 'returns a new instance' ); - t.strictEqual( out.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method does not change the array length', function test( t ) { - var arr; - var out; - - arr = new BooleanArray( 10 ); - out = arr.toReversed(); - - t.strictEqual( out.length, 10, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.to_sorted.js b/test/test.to_sorted.js deleted file mode 100644 index 1a9556d..0000000 --- a/test/test.to_sorted.js +++ /dev/null @@ -1,167 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var BooleanArray = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Comparison function. -* -* @private -* @param {boolean} a - first boolean value for comparison -* @param {boolean} b - second boolean value for comparison -* @returns {number} comparison result -*/ -function compareFcn( a, b ) { - if ( a === true ) { - if ( b === true ) { - return 0; - } - return 1; - } - if ( b === false ) { - return 0; - } - return -1; -} - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `toSorted` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'toSorted' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.toSorted ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toSorted.call( value, compareFcn ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toSorted( value ); - }; - } -}); - -tape( 'the method returns an empty array if operating on an empty boolean array', function test( t ) { - var arr; - var out; - - arr = new BooleanArray(); - out = arr.toSorted( compareFcn ); - - t.strictEqual( out.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns a new typed array containing elements in sorted order', function test( t ) { - var expected; - var arr; - var out; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - expected = new Uint8Array( [ 0, 0, 0, 1, 1, 1 ] ); - out = arr.toSorted( compareFcn ); - - t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' ); - t.notEqual( out, arr, 'returns a new instance' ); - t.strictEqual( out.length, expected.length, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the method does not change the array length', function test( t ) { - var arr; - var out; - - arr = new BooleanArray( [ true, false, false, true, true, false ] ); - out = arr.toSorted( compareFcn ); - - t.strictEqual( out.length, arr.length, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.to_string.js b/test/test.to_string.js deleted file mode 100644 index db7f927..0000000 --- a/test/test.to_string.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `toString` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.toString ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.toString.call( value ); - }; - } -}); - -tape( 'the method returns an empty string if invoked on an empty array', function test( t ) { - var str; - var arr; - - arr = new BooleanArray(); - str = arr.toString(); - - t.strictEqual( str, '', 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns a string representation of a boolean array', function test( t ) { - var expected; - var str; - var arr; - - arr = new BooleanArray( [ true, false, false, true ] ); - expected = 'true,false,false,true'; - - str = arr.toString(); - - t.strictEqual( str, expected, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.values.js b/test/test.values.js deleted file mode 100644 index 5de851a..0000000 --- a/test/test.values.js +++ /dev/null @@ -1,263 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `values` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'values' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.values ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.values.call( value ); - }; - } -}); - -tape( 'the method returns an iterator protocol-compliant object', function test( t ) { - var expected; - var arr; - var it; - var i; - var r; - var e; - - arr = new BooleanArray( [ true, false ] ); - expected = [ - { - 'value': true, - 'done': false - }, - { - 'value': false, - 'done': false - }, - { - 'done': true - } - ]; - it = arr.values(); - - t.strictEqual( typeof it, 'object', 'returns expected value' ); - t.strictEqual( typeof it.next, 'function', 'has next method' ); - - for ( i = 0; i < expected.length; i++ ) { - r = it.next(); - e = expected[ i ]; - if ( e.value === void 0 ) { - t.deepEqual( r, e, 'returns expected value' ); - } else { - t.strictEqual( isBoolean( r.value ), true, 'returns expected value' ); - t.strictEqual( r.value, e.value, 'returns expected value' ); - t.strictEqual( r.done, e.done, 'returns expected value' ); - } - } - - t.end(); -}); - -tape( 'the method returns an iterator which does not iterate over empty arrays', function test( t ) { - var expected; - var arr; - var it; - var i; - var v; - - arr = new BooleanArray( [] ); - expected = [ - { - 'done': true - }, - { - 'done': true - }, - { - 'done': true - } - ]; - it = arr.values(); - - t.strictEqual( typeof it, 'object', 'returns expected value' ); - t.strictEqual( typeof it.next, 'function', 'has next method' ); - - for ( i = 0; i < expected.length; i++ ) { - v = it.next(); - t.deepEqual( v, expected[ i ], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (no argument)', function test( t ) { - var arr; - var it; - var v; - - arr = new BooleanArray( [ true, false, true ] ); - it = arr.values(); - - v = it.next(); - t.strictEqual( v.value, true, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, false, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.return(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (argument)', function test( t ) { - var arr; - var it; - var v; - - arr = new BooleanArray( [ true, false, true ] ); - it = arr.values(); - - v = it.next(); - t.strictEqual( v.value, true, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, false, 'returns expected value' ); - t.strictEqual( v.done, false, 'returns expected value' ); - - v = it.return( 'beep' ); - t.strictEqual( v.value, 'beep', 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - v = it.next(); - t.strictEqual( v.value, void 0, 'returns expected value' ); - t.strictEqual( v.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'if an environment supports `Symbol.iterator`, the method returns an iterable', function test( t ) { - var BooleanArray; - var arr; - var buf; - var it1; - var it2; - var v1; - var v2; - var i; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/symbol-iterator': '__ITERATOR_SYMBOL__' - }); - - buf = [ 1, 0, 0, 1 ]; - arr = new BooleanArray( buf ); - - it1 = arr.values(); - t.strictEqual( typeof it1[ '__ITERATOR_SYMBOL__' ], 'function', 'has method' ); - t.strictEqual( it1[ '__ITERATOR_SYMBOL__' ].length, 0, 'has zero arity' ); - - it2 = it1[ '__ITERATOR_SYMBOL__' ](); - t.strictEqual( typeof it2, 'object', 'returns expected value' ); - t.strictEqual( typeof it2.next, 'function', 'has `next` method' ); - t.strictEqual( typeof it2.return, 'function', 'has `return` method' ); - - for ( i = 0; i < arr.length; i++ ) { - v1 = it1.next().value; - v2 = it2.next().value; - t.strictEqual( v1, v2, 'returns expected value' ); - } - t.end(); -}); - -tape( 'if an environment does not support `Symbol.iterator`, the method does not return an "iterable"', function test( t ) { - var BooleanArray; - var arr; - var buf; - var it; - - BooleanArray = proxyquire( './../lib/main.js', { - '@stdlib/symbol-iterator': false - }); - - buf = [ true, false, false, true ]; - arr = new BooleanArray( buf ); - - it = arr.values(); - t.strictEqual( it[ ITERATOR_SYMBOL ], void 0, 'does not have property' ); - - t.end(); -}); diff --git a/test/test.with.js b/test/test.with.js deleted file mode 100644 index 62cb315..0000000 --- a/test/test.with.js +++ /dev/null @@ -1,200 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); -var BooleanArray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof BooleanArray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the prototype of the main export is a `with` method', function test( t ) { - t.strictEqual( hasOwnProp( BooleanArray.prototype, 'with' ), true, 'has property' ); - t.strictEqual( isFunction( BooleanArray.prototype.with ), true, 'has method' ); - t.end(); -}); - -tape( 'the method throws an error if invoked with a `this` context which is not a boolean array instance', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.with.call( value, 0, true ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not an integer', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 5 ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.with( value, true ); - }; - } -}); - -tape( 'the method throws an error if provided a first argument which is not in bounds', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - -11, - -12, - 11, - 12 - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.with( value, false ); - }; - } -}); - -tape( 'the method throws an error if provided a second argument which is not a boolean', function test( t ) { - var values; - var arr; - var i; - - arr = new BooleanArray( 10 ); - - values = [ - '5', - 3.14, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.with( 0, value ); - }; - } -}); - -tape( 'the method does not change the array length', function test( t ) { - var arr; - var out; - - arr = new BooleanArray( 10 ); - out = arr.with( 5, true ); - - t.strictEqual( out.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the method returns a new boolean array with the element at a provided index replaced with a provided value', function test( t ) { - var expected; - var arr; - var out; - - arr = new BooleanArray( [ true, false, false, false ] ); - expected = new Uint8Array( [ 1, 0, 0, 1 ] ); - out = arr.with( 3, true ); - - t.strictEqual( out instanceof BooleanArray, true, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' ); - t.notEqual( out, arr, 'returns new instance' ); - t.end(); -}); - -tape( 'the method supports negative indices', function test( t ) { - var expected; - var arr; - var out; - - arr = new BooleanArray( [ true, false, false ] ); - expected = new Uint8Array( [ 1, 0, 1 ] ); - - out = arr.with( -1, true ); - - t.strictEqual( out instanceof BooleanArray, true, 'returns expected value' ); - t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' ); - t.end(); -});